0

你好,有人可以帮我解决这个我不太了解模板的 php,所以我已经把我的 php 放在托管中,当我启动它时。有这样的文字

“解析错误:语法错误,意外的 T_LNUMBER,在第 4 行的 /home/u623442461/public_html/d.php 中需要 ')'”

然后我在 phpcodechecker 上检查我的第 4 行,结果是这样的结果

结果

Error: There is 1 array declaration that contain a single equal sign '=' instead of '=>':

=array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,4323,5517, 7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,34610,38230,42031,4602 2,50213,54614,59235,64087,69182,74532,80150,86049,92243,98747,105576,112746,1202 75,128180,136480,145195,154346,163955,174044,184637,195760,207439,219702,232578, 246098,260294,275200,290851,307285,324541,342660,361685,381661,402636,424660,447 785,472066,497561,524331,552440,581954,612944,645484,679651,715526,756782,804226 ,858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,1912017,21 32746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,5617135,6393631,72 86601,8313517,9494470,2016089205);

PHP 语法检查:解析错误:语法错误,意外的 T_LNUMBER,在第 1 行的代码中需要 ')'

 $listlevel=array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,4323,5517, 7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,34610,38230,42031,4602 2,50213,54614,59235,64087,69182,74532,80150,86049,92243,98747,105576,112746,1202 75,128180,136480,145195,154346,163955,174044,184637,195760,207439,219702,232578, 246098,260294,275200,290851,307285,324541,342660,361685,381661,402636,424660,447 785,472066,497561,524331,552440,581954,612944,645484,679651,715526,756782,804226 ,858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,1912017,21 32746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,5617135,6393631,72 86601,8313517,9494470,2016089205);
4

4 回答 4

1

许多数字中都有空格。这就是导致错误的原因。

这是删除空格的正确声明:

第一个数组:

$numArray = array(0,40,60,100,200,350,550,800,1113,1504,1993,
    2604,3368,4323,5517,7010,8876,11209,13659,16232,18934,21771,
    24750,27878,31162,34610,38230,42031,46022,50213,54614,
    59235,64087,69182,74532,80150,86049,92243,98747,105576,
    112746,120275,128180,136480,145195,154346,163955,174044,
    184637,195760,207439,219702,232578, 246098,260294,275200,
    290851,307285,324541,342660,361685,381661,402636,424660,
    447785,472066,497561,524331,552440,581954,612944,645484,
    679651,715526,756782,804226,858787,921532,993689,1076670,
    1172098,1281840,1408043,1553176,1720079,1912017,2132746,
    2386584,2678498,3014199,3400255,3844219,4354778,4941921,
    5617135,6393631,7286601,8313517,9494470,2016089205);

第二个数组:

$listlevel = array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,
    4323,5517,7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,
    34610,38230,42031,46022,50213,54614,59235,64087,69182,74532,80150,
    86049,92243,98747,105576,112746,120275,128180,136480,145195,154346,
    163955,174044,184637,195760,207439,219702,232578,246098,260294,275200,
    290851,307285,324541,342660,361685,381661,402636,424660,447785,472066,
    497561,524331,552440,581954,612944,645484,679651,715526,756782,804226,
    858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,
    1912017,2132746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,
    5617135,6393631,7286601,8313517,9494470,2016089205);

旁注:您可以使用支持语法突出显示的 IDE。此外,将数组分成几行将提高可读性并帮助您快速发现错误。

希望这可以帮助!

于 2013-07-22T22:37:44.507 回答
0

您的数字中有多个空格(可能缺少一个点?)

IE

..., 7010,...
...,4602 2,..
...,72 86601,...
etc etc

也许你应该用你的编辑器检查你的代码

于 2013-07-22T22:36:22.247 回答
0

对于第二个数组..您comer在创建数组时错过了一个,但整数之间有一个空格..这会触发错误。

原片:

38230,42031,4602 2,50213,
                ^ // Missing comma 

以及这里:

,105576,112746,1202 75,128180,
                    ^ // Here

   361685,381661,402636,424660,447 785,
                                  ^ Here

,1912017,21 32746,2386584,2678498
           ^ Here

6393631,72 86601,8313517,9494470,2016089205
           ^Finally here

固定数组:

$listlevel=array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,4323,5517, 7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,34610,38230,42031,4602, 2,50213,54614,59235,64087,69182,74532,80150,86049,92243,98747,105576,112746,1202, 75,128180,136480,145195,154346,163955,174044,184637,195760,207439,219702,232578, 246098,260294,275200,290851,307285,324541,342660,361685,381661,402636,424660,447, 785,472066,497561,524331,552440,581954,612944,645484,679651,715526,756782,804226 ,858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,1912017,21, 32746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,5617135,6393631,72, 86601,8313517,9494470,2016089205);
于 2013-07-22T22:36:28.577 回答
0

您在其中一个数字中有一个空格:

$listlevel=array(... 1912017,21 32746,2386584...

于 2013-07-22T22:33:18.393 回答