PHP PG

TIPS



ignore_user_abort = On

mbstring

http://php.s3.to/man/ref.mbstring.html

gettype($hoge);
//while ($data = fgetcsv($fp,2048)) {
while ($data1 = fgets($fp,2048)) {
 $data1 = mb_convert_encoding($data1,"EUC-JP","SJIS");
 $data = mb_split(",",str_replace('"','',$data1));





http://www.fukushi-net.or.jp/takamoto/php/checkbox/

date("Y-m-d", strtotime("2007/02/10 22:40:00"));
date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")-1));
date('Y-m-d', strtotime('-1 day'));

HTTP_Request

HttpClient?

$req =& new HTTP_Request("http://www.hoge.ho");
$req->addHeader("User_Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
$req->addPostData('koumoku','atai');
$response = $req->sendRequest();
if (PEAR::isError($response)) {

$code = $req->getResponseCode();
$nexturl = $req->getResponseHeader("Location");
$req->setURL($nexturl);
$response = $req->sendRequest();
$req->_url->url
$body = $req->getResponseBody();

$bodyline = mb_split("\n",$body);
foreach($bodyline as $linedata){
$cookies = $req->getResponseCookies();
foreach ($loginCookies as $cookie) {
  $req->addCookie($cookie['name'], $cookie['value']);
}
$urlary = parse_url("http://hidekazu.dhs1.sst.ne.jp/pukiwiki/pukiwiki.php");
$urlary['scheme'];    http
$urlary['host'];    hidekazu.dhs1.sst.ne.jp
$urlary['path'];    /pukiwiki/pukiwiki.php
if (!checkdnsrr($hostpart,"ANY")) {
   //error
}

http://www.teu.ac.jp/chiit/~dsuzuki/phpdoc/function.checkdnsrr.html

system("/home/your/bgprog $arg1 $arg2 > /dev/null &");
set > path.log


$utime = date( "U" ) + 60 * 60 * 24;
$expires = date( "D, d M Y H:i:s", $utime )." GMT";
header("Expires: {$expires}");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ('Content-Type:text/html; charset='._CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0');
header("Pragma: no-cache");

Cache-Control: private, no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

$len = filesize($file_name);
header("Content-type: application/force-download");
header("Content-Disposition: attachment ; filename=download.csv");
header("Content-Length: ". $len) ;






unlink($file_name);
$dellpath = "/work";
$dir = opendir($dellpath);
while($file = readdir($dir)) {
 if(is_file($dellpath."/$file")) {
   unlink($dellpath."/$file");
 }
}
closedir($dir);


print_r($ary);

strip_tags

JpGraph?

KCAPTCHA

PDF



QR

http://blog.webcreativepark.net/2007/09/17-194842.html

$dbsaki = mysql_connect("host","user","pass");

mysql_select_db("dbname", $dbsaki);

$sql = "select ....";
mysql_query($sql,$dbsaki);

http://oshiete1.goo.ne.jp/kotaeru.php3?q=1447277

mysql_insert_id()

number_format
sprintf("%03d", $hoge);
$kkbody = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href='\\0' target='_blank'>\\0</a>",$kkbody);
$match = '[0-9,A-Z,a-z][0-9,a-z,A-Z,_,\.,-]+'
       .'@[0-9,A-Z,a-z][0-9,a-z,A-Z,_,\.,-]+\.'
       .'(com|net|org|gov|edu|int|mil|biz|info|name|pro|jp|af|al|dz|as|ad|ao|ai|aq|ag|ar|am|aw|ac|au|at|az|bh|bd|bb|by|bj|bm|bt|bo|ba|bw|br|io|bn|bg|bf|bi|kh|cm|ca|cv|cf|td|gg|je|cl|cn|cx|cc|co|km|cg|cd|ck|cr|ci|hr|cu|cy|cz|dk|dj|dm|do|tp|ec|eg|sv|gq|er|ee|et|fk|fo|fj|fi|fr|gf|pf|tf|fx|ga|gm|ge|de|gh|gi|gd|gp|gu|gt|gn|gw|gy|ht|hm|hn|hk|hu|is|in|id|ir|iq|ie|im|il|it|jm|jo|kz|ke|ki|kp|kr|kw|kg|la|lv|lb|ls|lr|ly|li|lt|lu|mo|mk|mg|mw|my|mv|ml|mt|mh|mq|mr|mu|yt|mx|fm|md|mc|mn|ms|ma|mz|mm|na|nr|np|nl|an|nc|nz|ni|ne|ng|nu|nf|mp|no|om|pk|pw|pa|pg|py|pe|ph|pn|pl|pt|pr|qa|re|ro|ru|rw|kn|lc|vc|ws|sm|st|sa|sn|sc|sl|sg|sk|si|sb|so|za|gs|es|lk|sh|pm|sd|sr|sj|sz|se|ch|sy|tw|tj|tz|th|bs|ky|tg|tk|to|tt|tn|tr|tm|tc|tv|ug|ua|ae|uk|us|um|uy|uz|vu|va|ve|vn|vg|vi|wf|eh|ye|yu|zm|zw)';
$kkbody = ereg_replace($match,"<a href='mailto:\\0'>\\0</a>",$kkbody);




トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS