{"id":3729,"date":"2011-02-07T01:00:00","date_gmt":"2011-02-06T16:00:00","guid":{"rendered":"http:\/\/keuko.exp.jp\/diary\/?p=3729"},"modified":"2011-02-07T01:00:00","modified_gmt":"2011-02-06T16:00:00","slug":"php%e9%96%8b%e7%99%ba%e3%81%a7%e4%bd%bf%e3%81%a3%e3%81%9f%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa","status":"publish","type":"post","link":"https:\/\/keuko.exp.jp\/diary\/?p=3729","title":{"rendered":"PHP\u958b\u767a\u3067\u4f7f\u3063\u305f\u30e9\u30a4\u30d6\u30e9\u30ea"},"content":{"rendered":"<ul>\n<li>Excel\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f<\/li>\n<\/ul>\n<p>Excel_Peruser<br \/>\n<a href=\"http:\/\/chazuke.com\/forum\/\" target=\"_blank\">http:\/\/chazuke.com\/forum\/<\/a><br \/>\nExcel_Reviser\u3092\u4f5c\u3063\u305f\u65b9\u304c\u4f5c\u3063\u305f\u3001Excel\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<br \/>\n\u5272\u3068\u30b7\u30f3\u30d7\u30eb\u306a\u30d5\u30a1\u30a4\u30eb\u5411\u3051\u306e\u3088\u3046\u3067\u3059\u3002\uff08\u753b\u50cf\u3092\u5c71\u307b\u3069\u8cbc\u3063\u305f\u308a\u3057\u305f\u3089\u30e1\u30e2\u30ea\u30aa\u30fc\u30d0\u30fc\u306b\u306a\u308a\u307e\u3057\u305f\u3002\uff09<br \/>\n\u3053\u3093\u306a\u611f\u3058\u3067\u3002<\/p>\n<pre>\n&#60;input type=&#34;file&#34; name=&#34;importfile111&#34; \/&#62;\n<\/pre>\n<pre class=\"mycode\">\nrequire_once('..\/tools\/Excel_Peruser\/peruser.php');\n\uff08\u4e2d\u7565\uff09\n$file = $_FILES['importfile111'];\n$tmpfile =  $file['tmp_name'];\n$peruser = new Excel_Peruser();\n$peruser-&#62;setInternalCharset($charset='utf-8');\n$peruser-&#62;setErrorHandling(1);\n$result = $peruser-&#62;fileread($tmpfile);\nif ($peruser-&#62;isError($result)) $errmes=$result-&#62;getMessage();\nfor ($row = 1; $row &#60; $rowcnt; $row++) {\n$col = $this-&#62;GetExcelColNo('A');\n$wk = $peruser-&#62;dispcell($sn, $row, $col, $mode=0);\n}\n<\/pre>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u5f62\u5f0f\u3060\u3068\u304b\u30b5\u30a4\u30ba\u3060\u3068\u304b\u306e\u30c1\u30a7\u30c3\u30af\u306f\u9069\u5f53\u306b\u304a\u9858\u3044\u3057\u307e\u3059\u3002<br \/>\nExcel_Reviser\u3068\u4e00\u7dd2\u306b\u4f7f\u3046\u5834\u5408\u306f\u300cErrMess\u300d\u3068\u3044\u3046\u30af\u30e9\u30b9\u540d\u304c\u91cd\u8907\u3057\u3066\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u3001Excel_Peruser\u306eErrMess\u3092ErrMess_peruser \u306e\u3088\u3046\u306b\u3001\u91cd\u8907\u3057\u306a\u3044\u540d\u79f0\u306b\u5909\u66f4\u3057\u307e\u3059\u3002peruser.php\u5185\u3067\u300cErrMess\u300d\u3092\u4f7f\u3063\u3066\u308b\u3068\u3053\u308d\u3082\u5168\u90e8\u4f75\u305b\u3066\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\uff08\u4eca\u56de\u306fExcel_Reviser\u3092\u30e1\u30a4\u30f3\u306b\u4f7f\u3063\u3066\u308b\u306e\u3067\u3001Excel_Peruser\u306e\u65b9\u306e\u540d\u79f0\u3092\u5909\u3048\u307e\u3057\u305f\u304c\u3001\u3069\u3061\u3089\u3092\u5909\u3048\u3066\u3082\u3088\u3044\u3088\u3046\u3067\u3059\u3002\uff09<br \/>\n\u30a8\u30af\u30bb\u30eb\u306e\u5217\u304b\u3089\u5217\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002\uff08GetExcelColNo()\uff09<br \/>\n\u304b\u3063\u3053\u3088\u3055\u3068\u304b\u7f8e\u3057\u3055\u3088\u308a\u3082\u3001\u5f8c\u3067\u5fd8\u308c\u3066\u3082\u306a\u3093\u3068\u304b\u306a\u308b\uff01\u3092\u30c6\u30fc\u30de\u306b\u4f5c\u3063\u3066\u307e\u3059\u3002\uff08\u3059\u3050\u5fd8\u308c\u307e\u3059\u3002\uff09<br \/>\n\u3069\u3063\u304b\u306b\u9069\u5f53\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"mycode\">\nconst _ALPHABET_CNT = 26;\nconst _ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\npublic function GetExcelColNo($colstr) {\n$rtn = '';\nif ($colstr != '') {\n$len = strlen($colstr);\nfor ($i = 1; $i &#60;= $len; $i++){\n$wk = substr($colstr, -1 * $i, 1);\n$wk = strtoupper($wk);\n$pos = strpos(self::_ALPHABET, $wk);\nif ($pos &#62;= 0 and $pos &#60; self::_ALPHABET_CNT) {\n$rtn = $rtn + (($pos + 1) * pow(self::_ALPHABET_CNT, ($i-1)));\n}\n}\n}\nreturn $rtn;\n}\n<\/pre>\n<p>\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305fExcel\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u53d6\u5f97\u3057\u3066DB\u306b\u767b\u9332\u3001\u3068\u304b\u304c\u7c21\u5358\u306b\u3067\u304d\u3066\u3044\u3044\u611f\u3058\u3067\u3059\u3002<br \/>\ncsv\u5f62\u5f0f\u3067\u4fdd\u5b58\u3057\u3066\u3082\u3089\u3063\u3066\u3082\u3044\u3044\u3093\u3060\u3051\u3069\u3001csv\u5f62\u5f0f\u306b\u4fdd\u5b58\u3059\u308b\u8aac\u660e\u3092\u3059\u308b\u306e\u304c\u7d50\u69cb\u3081\u3093\u3069\u3044\u306e\u3067\u3001\u3053\u3063\u3061\u3067\u7528\u610f\u3057\u305fExcel\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3060\u3051\u5165\u308c\u3066\u3082\u3089\u3063\u3066\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u3082\u3089\u3046\u65b9\u304c\u624b\u9806\u3082\u8aac\u660e\u3082\u7c21\u5358\u306a\u306e\u3067\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\nExcel_Peruser\u306f\u3001Excel2003\u5f62\u5f0f\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u306e\u30672007\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u8aad\u307f\u8fbc\u3081\u306a\u3044\u3088\u3046\u3067\u3059\u304c\u3001\u307e\u3060\u307e\u3060Office2003\u30e6\u30fc\u30b6\u306f\u6b8b\u3063\u3066\u308b\u304b\u3089\u3057\u3070\u3089\u304f\u306f\u3053\u308c\u3067\u3044\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u306a\u30fc\u3068\u601d\u3044\u307e\u3059\u30022007\u5f62\u5f0f\uff08.xlsx\uff09\u3067\u4fdd\u5b58\u3055\u308c\u308b\u3068\u3001Excel2003\u3067\u8aad\u3081\u306a\u3044\u3067\u3059\u3082\u3093\u306d\u3002\uff08\u8aad\u3081\u308b\u3068\u601d\u3046\u3051\u3069\u3001\u4e92\u63db\u30d1\u30c3\u30af\u306e\u8aac\u660e\u3068\u304b\u3081\u3093\u3069\u3044\u3002\uff09\uff08\u3072\u3069\u3044\u3002\uff09<\/p>\n<ul>\n<li>\u30e1\u30fc\u30eb\u9001\u4fe1<\/li>\n<\/ul>\n<p>Qdmail<br \/>\n<a href=\"http:\/\/hal456.net\/qdmail\/\" target=\"_blank\">http:\/\/hal456.net\/qdmail\/<\/a><br \/>\nQdsmtp<br \/>\n<a href=\"http:\/\/hal456.net\/qdsmtp\/\" target=\"_blank\">http:\/\/hal456.net\/qdsmtp\/<\/a><br \/>\n\u3042\u3063\u3055\u308a\u3068\u9001\u308c\u307e\u3057\u305f\u3002\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3068\u304b\u3042\u308b\u3068\u307e\u305f\u9055\u3046\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3067\u3059\u3051\u3069\u3002<\/p>\n<pre class=\"mycode\">\nrequire_once('..\/tools\/qdmail\/qdmail.php');\nrequire_once('..\/tools\/qdmail\/qdsmtp.php');\n\uff08\u4e2d\u7565\uff09\n$qdmail = & new Qdmail();\n$qdmail-&#62;smtp(true);\n$param = array(\n'host'=&#62;'smtp.example.com',    \/\/ \u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\n'port'=&#62; 587,                  \/\/ \u3053\u308c\u306fSMTPAuth\u306e\u4f8b\u3002\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u3044\u306a\u308925\u3067\uff2f\uff2b\u3002\n'from'=&#62;'from@example.com',    \/\/ Return-path: \u306b\u306a\u308a\u307e\u3059\u3002\n'protocol'=&#62;'SMTP_AUTH',       \/\/ \u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u3044\u306a\u3089\u3001'SMTP'\n'user'=&#62;'userid@example.com',  \/\/ SMTP\u30b5\u30fc\u30d0\u30fc\u306e\u30e6\u30fc\u30b6\u30fcID\n'pass' =&#62; 'pass999',           \/\/ SMTP\u30b5\u30fc\u30d0\u30fc\u306e\u8a8d\u8a3c\u30d1\u30b9\u30ef\u30fc\u30c9\n);\n$qdmail-&#62;smtpServer($param);\n$qdmail-&#62;errorDisplay(false);\n$qdmail-&#62;smtpObject()-&#62;errorDisplay = false;\n$qdmail-&#62;smtpLoglevelLink(true);\n$qdmail-&#62;logPath(LOGS);\n$qdmail-&#62;logFileName(\"mail.log\");\n$qdmail-&#62;errorlogPath(LOGS);\n$qdmail-&#62;errorlogFilename(\"error_mail.log\");\n$qdmail-&#62;to('test@test.com', '\u30c6\u30b9\u30c8\u3055\u3093');  \/\/ \u3042\u3066\u5148\n$qdmail-&#62;from('info@test.com');   \/\/ \u9001\u4fe1\u5143\n$qdmail-&#62;bcc('mymail@test.com');  \/\/ BCC\u3067\u9001\u308b\u5834\u5408\u306b\u8a2d\u5b9a\n$subject = '\u30c6\u30b9\u30c8';\n$qdmail-&#62;subject($subject);  \/\/ \u984c\u540d\n$text = '\u30c6\u30b9\u30c8\u3067\u3059\u3088\u30fc\u3002';\n$qdmail-&#62;text($text);        \/\/ \u672c\u6587\n$rtn = $qdmail-&#62;send();      \/\/ \u30e1\u30fc\u30eb\u3092\u9001\u4fe1\n<\/pre>\n<ul>\n<li>PDF\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210<\/li>\n<\/ul>\n<p>tcpdf<br \/>\n<a href=\"http:\/\/www.fpdf.org\" target=\"_blank\">http:\/\/www.fpdf.org<\/a><br \/>\nPDF\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<br \/>\n\u79c1\u304c\u4f7f\u3063\u3066\u308b\u306e\u306f\u30d0\u30fc\u30b8\u30e7\u30f3 5.9.029 \u3067\u3059\u304c\u3001\u65e5\u672c\u8a9e\u3082\u7279\u306b\u5316\u3051\u308b\u3053\u3068\u306a\u304f\u3059\u3093\u306a\u308a\u4f7f\u3048\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"mycode\">\nrequire_once('..\/tools\/tcpdf\/config\/lang\/eng.php');\nrequire_once('..\/tools\/tcpdf\/tcpdf.php');\nconst FONT_GOTHIC = 'kozgopromedium';\nconst FONT_MINCHO = 'kozminproregular';\n\uff08\u4e2d\u7565\uff09\n$pdf = new TCPDF($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false);\n$pdf-&#62;SetTitle($title);\n$pdf-&#62;SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);\n$language = array('a_meta_charset' =&#62; 'UTF-8', 'a_meta_dir' =&#62; 'ltr', 'a_meta_language' =&#62; 'ja', 'w_page' =&#62; '\u30da\u30fc\u30b8 : ');\n$pdf-&#62;setLanguageArray($language);\n$pdf-&#62;SetMargins($marginleft=20, $margintop=30, $marginright=20);\n$pdf-&#62;SetHeaderMargin(15);\n$pdf-&#62;SetFooterMargin(15);\n$pdf-&#62;SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);\n$pdf-&#62;setImageScale(PDF_IMAGE_SCALE_RATIO);\n$pdf-&#62;setHeaderFont(Array(self::FONT_GOTHIC, '', 11));\n$pdf-&#62;setFooterFont(Array(self::FONT_GOTHIC, '', 10));\n$pdf-&#62;setHeaderData($logo='', $logowidth=0, $headertitle='', $headerstring=$title);\n$pdf-&#62;setPrintHeader(true);\n$pdf-&#62;setPrintFooter($withpage);\n$this-&#62;pdf-&#62;AddPage();\n$this-&#62;pdf-&#62;SetFont(self::FONT_GOTHIC, '', 12);\n$txt = '\u30c6\u30b9\u30c8\u3067\u3059\uff01';\n$this-&#62;pdf-&#62;Write($h=0, $txt, $link='', $fill=0, $align='L', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);\n$this-&#62;pdf-&#62;Ln(3);\n$txt = '\u30c6\u30b9\u30c8\u3067\u3059\u3088\uff01';\n$this-&#62;pdf-&#62;Write($h=0, $txt, $link='', $fill=0, $align='L', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);\n$filename = 'test.pdf';\n$this-&#62;pdf-&#62;Output($filename, 'D');\n<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001Output() \u306e\u7b2c2\u5f15\u6570\u306f<br \/>\nI : \u30d6\u30e9\u30a6\u30b6\u306b\u51fa\u529b\u3059\u308b(\u65e2\u5b9a)\u3001\u4fdd\u5b58\u6642\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c$name\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\u306b\u306a\u308b\u3002<br \/>\nD : \u30d6\u30e9\u30a6\u30b6\u3067(\u5f37\u5236\u7684\u306b)\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3002<br \/>\nF : \u30ed\u30fc\u30ab\u30eb\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3002<br \/>\nS : PDF\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u5185\u5bb9\u3092\u6587\u5b57\u5217\u3068\u3057\u3066\u51fa\u529b\u3059\u308b\u3002<br \/>\n\u3060\u305d\u3046\u3067\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u65e5\u672c\u8a9e\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u3053\u3093\u306a\u611f\u3058\u306b\u3057\u306a\u3044\u3068\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u306f\u5316\u3051\u307e\u304f\u308a\u3067\u3059\u3002<br \/>\n\uff08\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306fUTF-8\u3067\u3059\u3002\uff09<\/p>\n<pre class=\"mycode\">\n$charset_pg = 'UTF-8';  \/\/ PG\u306fUTF-8\n$charset = 'UTF-8';     \/\/ \u57fa\u672c\u306fUTF-8\n$ua = $_SERVER['HTTP_USER_AGENT'];\nif (strstr($ua, 'MSIE') && !strstr($ua, 'Opera')) {\n\/\/ IE\uff08\u30aa\u30da\u30e9\u306e\u4eee\u88c5\u3067\u306a\u3044\uff09\u306fSJIS\u306b\u3057\u306a\u3044\u3068\u5316\u3051\u308b\n$charset = 'SJIS-win';\n}\nif ($charset != $charset_pg) {\n$filename = mb_convert_encoding($filename, $charset, $charset_pg);\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Excel\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f Excel_Peruser http:\/\/chazuke.com\/forum\/ Excel_Reviser\u3092\u4f5c\u3063\u305f\u65b9\u304c\u4f5c\u3063\u305f\u3001Excel\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002 \u5272\u3068\u30b7\u30f3\u30d7\u30eb<\/p>\n<p><a class=\"button\" href=\"https:\/\/keuko.exp.jp\/diary\/?p=3729\" title=\"More\">  \u7d9a\u304d\u3092\u8aad\u3080 \u2192<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-3729","post","type-post","status-publish","format-standard","hentry","category-job"],"_links":{"self":[{"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=\/wp\/v2\/posts\/3729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3729"}],"version-history":[{"count":0,"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=\/wp\/v2\/posts\/3729\/revisions"}],"wp:attachment":[{"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keuko.exp.jp\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}