{"id":668,"date":"2026-05-05T08:56:18","date_gmt":"2026-05-05T00:56:18","guid":{"rendered":"https:\/\/book.yuekegu.com\/?p=668"},"modified":"2026-05-05T08:56:19","modified_gmt":"2026-05-05T00:56:19","slug":"%e5%ae%9e%e7%8e%b0%e6%95%b4%e5%90%88%e8%a1%a8%e5%a4%b4","status":"publish","type":"post","link":"https:\/\/book.yuekegu.com\/index.php\/2026\/05\/05\/%e5%ae%9e%e7%8e%b0%e6%95%b4%e5%90%88%e8%a1%a8%e5%a4%b4\/","title":{"rendered":"\u5b9e\u73b0\u6574\u5408\u8868\u5934"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\nArray\n(\n    &#91;A] => \u59d3\u540d\n    &#91;B] => \u8003\u53f7\n    &#91;C] => \u73ed\u7ea7\n    &#91;D] => \u539f\u59cb\u5206\n    &#91;E] => \u5ba2\u89c2\u9898\u5f97\u5206\n    &#91;F] => \u4e3b\u89c2\u9898\u5f97\u5206\n    &#91;G] => \u5f97\u5206:01\n    &#91;H] => \u4f5c\u7b54:01\n    &#91;I] => \u5f97\u5206:02\n    &#91;J] => \u4f5c\u7b54:02\n    &#91;K] => \u5f97\u5206:03\n    &#91;L] => \u4f5c\u7b54:03\n    &#91;M] => \u5f97\u5206:04\n    &#91;N] => \u4f5c\u7b54:04\n    &#91;O] => \u5f97\u5206:05\n    &#91;P] => \u4f5c\u7b54:05\n    &#91;Q] => \u5f97\u5206:06\n    &#91;R] => \u4f5c\u7b54:06\n    &#91;S] => \u5f97\u5206:07\n    &#91;T] => \u4f5c\u7b54:07\n    &#91;U] => \u5f97\u5206:08\n    &#91;V] => \u4f5c\u7b54:08\n    &#91;W] => \u5f97\u5206:09\n    &#91;X] => \u4f5c\u7b54:09\n    &#91;Y] => \u5f97\u5206:10\n    &#91;Z] => \u4f5c\u7b54:10\n    &#91;AA] => \u5f97\u5206:11\n    &#91;AB] => \u4f5c\u7b54:11\n    &#91;AC] => \u5f97\u5206:12\n    &#91;AD] => \u4f5c\u7b54:12\n    &#91;AE] => \u5f97\u5206:13\n    &#91;AF] => \u4f5c\u7b54:13\n    &#91;AG] => \u5f97\u5206:14\n    &#91;AH] => \u4f5c\u7b54:14\n    &#91;AI] => \u5f97\u5206:15\n    &#91;AJ] => \u4f5c\u7b54:15\n    &#91;AK] => \u5f97\u5206:16\n    &#91;AL] => \u4f5c\u7b54:16\n    &#91;AM] => \u5f97\u5206:17\n    &#91;AN] => \u4f5c\u7b54:17\n    &#91;AO] => \u5f97\u5206:18\n    &#91;AP] => \u4f5c\u7b54:18\n    &#91;AQ] => \u5f97\u5206:19\n    &#91;AR] => \u4f5c\u7b54:19\n    &#91;AS] => \u5f97\u5206:20\n    &#91;AT] => \u4f5c\u7b54:20\n    &#91;AU] => \u5f97\u5206:21\n    &#91;AV] => \u4f5c\u7b54:21\n    &#91;AW] => \u5f97\u5206:22\n    &#91;AX] => \u4f5c\u7b54:22\n    &#91;AY] => \u5f97\u5206:23\n    &#91;AZ] => \u4f5c\u7b54:23\n    &#91;BA] => \u5f97\u5206:24\n    &#91;BB] => \u4f5c\u7b54:24\n    &#91;BC] => \u5f97\u5206:25\n    &#91;BD] => \u4f5c\u7b54:25\n    &#91;BE] => \u5f97\u5206:26\n    &#91;BF] => \u4f5c\u7b54:26\n    &#91;BG] => \u5f97\u5206:27\n    &#91;BH] => \u4f5c\u7b54:27\n    &#91;BI] => \u5f97\u5206:28\n    &#91;BJ] => \u4f5c\u7b54:28\n    &#91;BK] => \u5f97\u5206:29\n    &#91;BL] => \u4f5c\u7b54:29\n    &#91;BM] => \u5f97\u5206:30\n    &#91;BN] => \u4f5c\u7b54:30\n    &#91;BO] => \u5f97\u5206:31\n    &#91;BP] => \u4f5c\u7b54:31\n    &#91;BQ] => \u5f97\u5206:32\n    &#91;BR] => \u4f5c\u7b54:32\n    &#91;BS] => \u5f97\u5206:33\n    &#91;BT] => \u4f5c\u7b54:33\n    &#91;BU] => \u5f97\u5206:34\n    &#91;BV] => \u4f5c\u7b54:34\n    &#91;BW] => \u5f97\u5206:35\n    &#91;BX] => \u4f5c\u7b54:35\n    &#91;BY] => \u5f97\u5206:36\n    &#91;BZ] => \u4f5c\u7b54:36\n    &#91;CA] => \u5f97\u5206:37\n    &#91;CB] => \u4f5c\u7b54:37\n    &#91;CC] => \u5f97\u5206:38\n    &#91;CD] => \u4f5c\u7b54:38\n    &#91;CE] => \u5f97\u5206:39\n    &#91;CF] => \u4f5c\u7b54:39\n    &#91;CG] => \u5f97\u5206:40\n    &#91;CH] => \u4f5c\u7b54:40\n    &#91;CI] => \u5f97\u5206:41\n    &#91;CJ] => \u4f5c\u7b54:41\n    &#91;CK] => \u5f97\u5206:42\n    &#91;CL] => \u4f5c\u7b54:42\n    &#91;CM] => \u5f97\u5206:43\n    &#91;CN] => \u4f5c\u7b54:43\n    &#91;CO] => \u5f97\u5206:44\n    &#91;CP] => \u4f5c\u7b54:44\n    &#91;CQ] => \u5f97\u5206:45\n    &#91;CR] => \u4f5c\u7b54:45\n    &#91;CS] => \u5f97\u5206:46\n    &#91;CT] => \u4f5c\u7b54:46\n    &#91;CU] => \u5f97\u5206:47\n    &#91;CV] => \u4f5c\u7b54:47\n    &#91;CW] => \u5f97\u5206:48\n    &#91;CX] => \u4f5c\u7b54:48\n    &#91;CY] => \u5f97\u5206:49\n    &#91;CZ] => \u4f5c\u7b54:49\n    &#91;DA] => \u5f97\u5206:50\n    &#91;DB] => \u4f5c\u7b54:50\n    &#91;DC] => \u5f97\u5206:51\n    &#91;DD] => \u4f5c\u7b54:51\n    &#91;DE] => \u5f97\u5206:52\n    &#91;DF] => \u4f5c\u7b54:52\n    &#91;DG] => \u5f97\u5206:53\n    &#91;DH] => \u4f5c\u7b54:53\n    &#91;DI] => \u5f97\u5206:54\n    &#91;DJ] => \u4f5c\u7b54:54\n    &#91;DK] => \u5f97\u5206:55\n    &#91;DL] => \u4f5c\u7b54:55\n    &#91;DM] => \u5f97\u5206:56-65\n    &#91;DN] => \u5f97\u5206:66\n    &#91;DO] => \u5f97\u5206:67\n)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\n        $info = File::checkLocalFile($file_id,'studentScore');\n\n        if(file_exists($info&#91;'path']))\n        {\n\n            try {\n\n                $data = \\moonland\\phpexcel\\Excel::widget(&#91;\n                    'mode' => 'import',\n                    'fileName' => $info&#91;'path'],\n                    'setFirstRecordAsKeys' => false, \/\/ if you want to set the keys of record column with first record, if it not set, the header with use the alphabet column on excel.\n                    'setIndexSheetByName' => true, \/\/ set this if your excel data with multiple worksheet, the index of array will be set with the sheet name. If this not set, the index will use numeric.\n                    \/\/ 'getOnlySheet' => '\u6821\u73ed\u7ea7\u6210\u7ee9\u8868', \/\/ you can set this property if you want to get the specified sheet from the excel data with multiple worksheet.\n                ]);\n                \n                \/\/ \u68c0\u67e5\u6587\u4ef6\u7684\u4e0b\u8f7d\u65f6\u95f4\uff0c\u82e5\u8d85\u8fc72\u5929\uff0c\u5219\u5220\u9664\u4e34\u65f6\u5904\u7406\u6587\u4ef6\n                $fileTime = filemtime($info&#91;'path']);\n                $currentTime = time();\n                $oneDay = 24 * 60 * 60 * 2;\n                if ($currentTime - $fileTime > $oneDay) {\n                    unlink($info&#91;'path']);\n                }\n            } catch (\\Exception $e) {\n                \/\/ \u5982\u679c\u5904\u7406\u5931\u8d25\uff0c\u5c1d\u8bd5\u76f4\u63a5\u5bfc\u5165\u539f\u59cb\u6587\u4ef6\n                $data = \\moonland\\phpexcel\\Excel::widget(&#91;\n                    'mode' => 'import',\n                    'fileName' => $info&#91;'path'],\n                    'setFirstRecordAsKeys' => false,\n                    'setIndexSheetByName' => true,\n                ]);\n            }\n\n            $title = &#91;];\n\n            $t = $data&#91;2];\n            $keys = array_keys($t);\n            $values = array_values($t);\n            \/\/ foreach($values as $key => $value)\n            \/\/ {\n            \/\/     $t&#91;$keys&#91;$key]] = $value;\n            \/\/ }\n\n            \/\/ print_r($data&#91;3])\n            \/\/\u5c06$data&#91;2]\u4e2d\u7684\u6240\u6709\u6570\u636e\u4e2d\u7684 (*)\u5185\u5bb9\u53bb\u9664,\u6bd4\u5982\uff1a 01(\u6ee1\u52061.5\u5206\uff0c\u6b63\u786e\u7b54\u6848\uff1aA)\u4fee\u6539\u4e3a01            \n            foreach($values as $key => $value)\n            {\n\n    \n\n                $text = preg_replace('\/\\(&#91;^)]*\\)\/', '', $value);\n                $text = trim($text);\n                $m&#91;$key] = $text;\n\n                \/\/ if($data&#91;2]&#91;$key] == '')\n                \/\/ {\n                \/\/     $data&#91;2]&#91;$key] = $data&#91;2]&#91;$key-1] ?? '';\n                \/\/ }\n                if($text == '')\n                {\n                    \/\/ $t&#91;$keys&#91;$key]] = $values&#91;$key-1] ?? '';\n                    $text = $m&#91;$key-1] ?? '';\n                }\n\n                \/\/ print_r($keys&#91;$key].'-'.$text.\"\\r\\n\");\n\n                if($data&#91;3]&#91;$keys&#91;$key]] == '')\n                {\n                    $t&#91;$keys&#91;$key]] = $text;\n                }\n                else\n                {\n                    $t&#91;$keys&#91;$key]] = $data&#91;3]&#91;$keys&#91;$key]].':'.$text;\n                }\n\n\n                \/\/ $t&#91;$keys&#91;$key]] = $data&#91;3]&#91;$keys&#91;$key]].'-'.$text;\n            }\n\n            $title = $t;\n\n            \/\/\u6574\u5408$t\u548c$data&#91;3]\n            \/\/ $t = array_merge($t, $data&#91;3]);\n\n            print_r($t);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-668","post","type-post","status-publish","format-standard","hentry","category-27"],"_links":{"self":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/comments?post=668"}],"version-history":[{"count":1,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/668\/revisions"}],"predecessor-version":[{"id":669,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/668\/revisions\/669"}],"wp:attachment":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/media?parent=668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/categories?post=668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/tags?post=668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}