Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP解析错误?_Php_Wordpress - Fatal编程技术网

PHP解析错误?

PHP解析错误?,php,wordpress,Php,Wordpress,在我的wordpress网站中尝试使用以下代码时,我遇到了一个解析错误(意外的T_Else)。有什么线索吗?对不起,新来的PHP,请耐心听我说 <?php if (time() >= strtotime('11/28/2011') && time() <= strtotime('12/25/2011')) { include (TEMPLATEPATH . '/stub_s10_Nov28-Dec25.php'); } else if (time() &

在我的wordpress网站中尝试使用以下代码时,我遇到了一个解析错误(意外的T_Else)。有什么线索吗?对不起,新来的PHP,请耐心听我说

<?php 
if (time() >= strtotime('11/28/2011') && time() <= strtotime('12/25/2011')) 
 { include (TEMPLATEPATH . '/stub_s10_Nov28-Dec25.php');
 }
else if (time() >= strtotime('12/26/2011') && time() <= strtotime('01/14/2012'))
 { include (TEMPLATEPATH . '/stub_s11_Dec26-Jan14.php');
 }
else if (time() >= strtotime('01/15/2011') && time() <= strtotime('02/14/2011'))
 { include (TEMPLATEPATH . '/stub_s2_Jan15-Feb14.php');
 } 
else if (time() >= strtotime('02/15/2011') && time() <= strtotime('03/17/2011'))
 { include (TEMPLATEPATH . '/stub_s3_Feb15-Mar17.php');
 }
else if (time() >= strtotime('03/18/2011') && time() <= strtotime('04/30/2011'))
 { include (TEMPLATEPATH . '/stub_s4_Mar18-Apr30.php');

else if (time() >= strtotime('05/01/2011') && time() <= strtotime('05/30/2011'))
 { include (TEMPLATEPATH . '/stub_s5_May01-May30.php');
 }
else if (time() >= strtotime('06/01/2011') && time() <= strtotime('07/04/2011'))
 { include (TEMPLATEPATH . '/stub_s6_Jun01-Jul04.php');
 }
else if (time() >= strtotime('07/05/2011') && time() <= strtotime('08/31/2011'))
 { include (TEMPLATEPATH . '/stub_s7_Jul05-Aug31.php');
 }
else if (time() >= strtotime('09/01/2011') && time() <= strtotime('10/31/2011'))
 { include (TEMPLATEPATH . '/stub_s8_Sep01-Oct31.php');
 }
else if (time() >= strtotime('11/27/2011') && time() <= strtotime('11/27/2011'))
 { include (TEMPLATEPATH . '/stub_s9_Nov01-Nov27.php');
 }
?> 

在“'/stub\u s4\u Mar18-Apr30.php')行后面缺少一个右括号,这很可能导致此问题


顺便说一句,您可能希望将当前时间存储在变量中,而不是重复调用time()函数。我也很想使用,除非您特别不介意include失败。

您忘记了第17行的结束符
}

<?php 
if (time() >= strtotime('11/28/2011') && time() <= strtotime('12/25/2011')) 
 { include (TEMPLATEPATH . '/stub_s10_Nov28-Dec25.php');
 }
else if (time() >= strtotime('12/26/2011') && time() <= strtotime('01/14/2012'))
 { include (TEMPLATEPATH . '/stub_s11_Dec26-Jan14.php');
 }
else if (time() >= strtotime('01/15/2011') && time() <= strtotime('02/14/2011'))
 { include (TEMPLATEPATH . '/stub_s2_Jan15-Feb14.php');
 } 
else if (time() >= strtotime('02/15/2011') && time() <= strtotime('03/17/2011'))
 { include (TEMPLATEPATH . '/stub_s3_Feb15-Mar17.php');
 }
else if (time() >= strtotime('03/18/2011') && time() <= strtotime('04/30/2011'))
 { include (TEMPLATEPATH . '/stub_s4_Mar18-Apr30.php');
 }
else if (time() >= strtotime('05/01/2011') && time() <= strtotime('05/30/2011'))
 { include (TEMPLATEPATH . '/stub_s5_May01-May30.php');
 }
else if (time() >= strtotime('06/01/2011') && time() <= strtotime('07/04/2011'))
 { include (TEMPLATEPATH . '/stub_s6_Jun01-Jul04.php');
 }
else if (time() >= strtotime('07/05/2011') && time() <= strtotime('08/31/2011'))
 { include (TEMPLATEPATH . '/stub_s7_Jul05-Aug31.php');
 }
else if (time() >= strtotime('09/01/2011') && time() <= strtotime('10/31/2011'))
 { include (TEMPLATEPATH . '/stub_s8_Sep01-Oct31.php');
 }
else if (time() >= strtotime('11/27/2011') && time() <= strtotime('11/27/2011'))
 { include (TEMPLATEPATH . '/stub_s9_Nov01-Nov27.php');
 }
?> 


如果块似乎缺少一个右括号,则第五个

错误消息是否给出错误位置的任何指示?通常,将准确的错误信息粘贴到问题中是一个好主意。另外,一个通常很好的方法是将代码缩减到更小的部分,然后看看问题是否仍然存在。如果这种情况仍然发生,你可以用一个更方便的例子向人们展示。如果问题消失了,你就学到了一些关于这个问题的有用的东西(即它与你剪下的材料有某种联系)。你知道
如果
应该是
elseif
作为一个词吗?@Jonno\u FTW:它可以是一个词,不一定是。