<br />
<b>Warning</b>:  Undefined array key "HTTP_ACCEPT_LANGUAGE" in <b>/www/wwwroot/01xj.net/wp-content/plugins/wp-ue/main.php</b> on line <b>13</b><br />
{"id":168,"date":"2011-10-08T11:28:36","date_gmt":"2011-10-08T11:28:36","guid":{"rendered":"http:\/\/www.01xj.net\/0\/?p=168"},"modified":"2011-10-08T11:28:36","modified_gmt":"2011-10-08T11:28:36","slug":"php%e6%93%8d%e4%bd%9cexcel%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.01xj.net\/?p=168","title":{"rendered":"php\u64cd\u4f5cexcel\u6587\u4ef6"},"content":{"rendered":"<p>PHP\u64cd\u4f5cexcel\u6587\u4ef6<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nExcel \u7c7b    V1.1<br \/>\n                By Monkey<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>&#8212;&#8211;\u51fd\u6570\u8bf4\u660e<br \/>\n\u8bfb\u53d6Excel\u6587\u4ef6<br \/>\nfunction Read_Excel_File($ExcelFile,$Result)<\/p>\n<p>$ExcelFile    Excel\u6587\u4ef6\u540d<br \/>\n$Result        \u8fd4\u56de\u7684\u7ed3\u679c<br \/>\n\u51fd\u6570\u8fd4\u56de\u503c    \u6b63\u5e38\u8fd4\u56de0\uff0c\u5426\u5219\u8fd4\u56de\u9519\u8bef\u4fe1\u606f<\/p>\n<p>\u8fd4\u56de\u7684\u503c\u6570\u7ec4<br \/>\n    $result[sheet\u540d][\u884c][\u5217] \u7684\u503c\u4e3a\u76f8\u5e94Excel Cell\u7684\u503c<\/p>\n<p>\u5efa\u7acbExcel\u6587\u4ef6<br \/>\nfunction Create_Excel_File($ExcelFile,$Data)<\/p>\n<p>$ExcelFile    Excel\u6587\u4ef6\u540d<br \/>\n$Data        Excel\u8868\u683c\u6570\u636e<br \/>\n\u8bf7\u628a\u51fd\u6570\u5199\u5728PHP\u811a\u672c\u7684\u5f00\u5934<\/p>\n<p>\u4f8b1\uff1a<br \/>\n<?\nrequire \"excel_class.php\";\n\nRead_Excel_File(\"Book1.xls\",$return);\n\nfor ($i=0;$i<count($return[Sheet1]);$i++)\n{\n    for ($j=0;$j<count($return[Sheet1][$i]);$j++)\n    {\n        echo $return[Sheet1][$i][$j].\"|\";\n    }\n    echo \"<br \/>&#8220;;<br \/>\n}<br \/>\n?><\/p>\n<p>\u4f8b2\uff1a<br \/>\n<?\nrequire \"excel_class.php\";\n\nRead_Excel_File(\"Book1.xls\",$return);\nCreate_Excel_File(\"ddd.xls\",$return[Sheet1]);\n?><\/p>\n<p>\u7c7b\u6587\u4ef6\uff1aexcel_class.zip<br \/>\n\u4e0b\u8f7d\u5730\u5740\uff1ahttp:\/\/www.cnblogs.com\/Files\/coolstr\/excel_class.zip<\/p>\n<p>\u9700\u8981\u5f80\u4e00\u4e2aexcel\u6587\u4ef6\u7684\u67d0\u4e2a\u5355\u5143\u683c\u5199\u6570\u636e\uff0c\u8be5\u5982\u4f55\u64cd\u4f5c\uff1f<br \/>\n\/\/\u9996\u5148\u4e00\u6b65<br \/>\n$excel = new COM(&#8220;Excel.sheet&#8221;) or Die (&#8220;Did not instantiate Excel&#8221;);\/\/ \u5efa\u7acbEXCEL\u7684COM\u5bf9\u8c61<\/p>\n<p>\/\/\u6253\u5f00\u4e00\u4e2a\u5de5\u4f5c\u7c3f<br \/>\n$pathin = &#8220;\u5de5\u4f5c\u7c3f\u76ee\u5f55&#8221;;<br \/>\n$workbook = &#8220;\u5de5\u4f5c\u7c3f\u540d\u79f0&#8221;;<br \/>\n$wkb = $excel->application->Workbooks->Open($pathin.$workbook) or Die (&#8220;Did not open $pathin $workbook&#8221;);<\/p>\n<p>\/\/\u5efa\u65b0\u5de5\u4f5c\u7c3f<br \/>\n$wkb = $excel->application->Workbooks->Add or Die(&#8220;Unable to add a new work book&#8221;);<\/p>\n<p>\/\/\u6253\u5f00\u5de5\u4f5c\u8868<br \/>\n$sheet_name = &#8220;sheet1&#8221;<br \/>\n$sheet = $wkb->Worksheets($sheet_name) or Die(&#8220;Unable to active $sheet_name&#8221;);<\/p>\n<p>\/\/\u8bfb\u4e00\u4e2a\u5355\u5143\u683c<br \/>\n$readcell = $sheet->cells($row,$column); \/\/\u884c\u548c\u5217\u76f4\u63a5\u7528\u5341\u8fdb\u5236\u6570\u8868\u793a<br \/>\n$readcell->activate;<br \/>\n$result = $selcell->value; \/\/\u8bfb\u51fa\u5355\u5143\u683c\u503c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u64cd\u4f5cexcel\u6587\u4ef6 &#8212;&#8212;&#8212;&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-168","post","type-post","status-publish","format-standard","hentry","category-phpjsshell"],"_links":{"self":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":1,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":169,"href":"https:\/\/www.01xj.net\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/169"}],"wp:attachment":[{"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.01xj.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}