for( $i=0; $i<count($hoge); $i++ ) { echo "<p>".$hoge[$i]; }
foreach($hoge as $key => $val) { echo "<p>".$key.":".$val; }
$hogearray = array();
ignore_user_abort = On
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'));
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
wget http://downloads.sourceforge.net/tcpdf/tcpdf_4_0_027_php4.zip?modtime=1221827720&big_mirror=0 unzip tcpdf_4_0_027_php4.zip mv tcpdf_php4 /usr/local/lib/php
cd /usr/local/lib/php/tcpdf_php4/fonts/utils/src/ttf2ufm-src make all
scripts/unhtml <FONTS.hpux.html >FONTS.hpux
chmod -R 777 /usr/local/lib/php/tcpdf_php4/fonts/utils/src/ttf2ufm-src make all make install
wget http://ossipedia.ipa.go.jp/ipafont/IPAfont00203.php unzip IPAfont00203.zip cd IPAfont00203 ttf2pt1 -a -F ipag.ttf /usr/local/lib/php/tcpdf_php4/fonts/utils/makefont.php ipag.ttf ipag.ufm cp ipag.php /usr/local/lib/php/tcpdf_php4/fonts/ipagothic.php cp ipag.ctg.z /usr/local/lib/php/tcpdf_php4/fonts/ cp ipag.z /usr/local/lib/php/tcpdf_php4/fonts/
TCPDF
PHP + TCPDF + FPDI + FPDI_Template
FPDF http://www.fpdf.org/en/dl.php?id=99
unzip fpdf16.zip mkdir /usr/local/lib/php/pdf cp fpdf.php /usr/local/lib/php/pdf/ cp -rf font /usr/local/lib/php/pdf/ wget http://www.fpdf.org/download/japanese.zip unzip japanese.zip cp japanese.php /usr/local/lib/php/pdf
$name='KozMinPro-Regular-Acro';
$name='MSGothic';
<?php require('pdf/japanese.php'); define(SC_CHAR, "EUC-JP"); $pdf = new PDF_Japanese(); $pdf->AddSJISFont(); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont('SJIS', '', 9); $pdf->Output(); function sjis_conv($conv_str) { return (mb_convert_encoding($conv_str, "SJIS", SC_CHAR)); } ?>
FPDF error: mbstring overloading must be disabled
mbstring.func_overload = 7
php_value mbstring.func_overload 0
http://www.setasign.de/products/pdf-php-solutions/fpdi/
FPDI-1.2.1.zip FPDF_TPL-1.1.2.zip
cp -rf * /usr/local/lib/php/pdf/
require('fpdf.php');
require('fpdi.php');
class PDF_Japanese extends FPDF
class PDF_Japanese extends FPDI
<?php require('pdf/japanese.php'); define(SC_CHAR, "EUC-JP"); define(TMPL_PDF, "tmp.pdf"); $pdf = new PDF_Japanese(); $pdf->AddSJISFont(); $pdf->Open(); $pageno = $pdf->setSourceFile(TMPL_PDF); $tplidx = $pdf->ImportPage(1); $pdf->AddPage(); $pdf->SetFont('SJIS', '', 9); $pdf->useTemplate($tplidx); $pdf->SetFont('SJIS', '', 30); $pdf->SetFont('SJIS', '', 20); $pdf->Output(); function sjis_conv($conv_str) { return (mb_convert_encoding($conv_str, "SJIS", SC_CHAR)); } ?>
cp -rf * /usr/local/lib/php/pdf/
<?php require_once 'pdf/mbfpdf.php'; $GLOBALS['EUC2SJIS'] = true; $pdf=new MBFPDF('P', 'mm', 'A4'); $pdf->AddMBFont(GOTHIC ,'SJIS'); $pdf->AddPage(); $pdf->SetFont(GOTHIC,'',20); $pdf->Output(); ?>
require('fpdf.php');
require('fpdi.php');
class MBFPDF extends FPDF
class MBFPDF extends fpdi
<?php require_once 'pdf/mbfpdf.php'; $GLOBALS['EUC2SJIS'] = true; define("SC_CHAR", "EUC-JP"); define("TMPL_PDF", "tmp.pdf"); $pdf=new MBFPDF('P', 'mm', 'A4'); $pdf->AddMBFont(GOTHIC ,'SJIS'); $pdf->Open(); $pageno = $pdf->setSourceFile(TMPL_PDF); $tplidx = $pdf->ImportPage(1); $pdf->AddPage(); $pdf->SetFont(GOTHIC, '', 9); $pdf->useTemplate($tplidx); $pdf->SetFont(GOTHIC, '', 30); $pdf->SetFont(GOTHIC, '', 20); $pdf->Output(); function sjis_conv($conv_str) { return (mb_convert_encoding($conv_str, "SJIS", SC_CHAR)); } ?>
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);
<?php $im1 = ImageCreateFromJpeg("a.jpg"); $im2 = ImageCreateFromGif("b.gif"); ImageCopy($im1, $im2, 470, 400, 0, 0, 169, 85); Imagejpeg($im1,"/hoge/c.jpg"); ImageDestory($im1); ImageDestory($im2); ?>