在我的旧服务器上,即使没有声明“s”参数,以下代码似乎也可以正常工作。
<?php
if ($_GET['s'] == 'jwshxnsyllabus')
echo "<body onload=\"loadSyllabi('syllabus', '../syllabi/jwshxnporsyllabus.xml', '../bibliographies/jwshxnbibliography_')\">";
if ($_GET['s'] == 'aquinas')
echo "<body onload=\"loadSyllabi('syllabus', '../syllabi/AquinasSyllabus.xml')\">";
if ($_GET['s'] == 'POP2')
echo "<body onload=\"loadSyllabi('POP2')\">";
elseif ($_GET['s'] == null)
echo "<body>"
?>
但是现在,在我的本地机器上(XAMPP - Apache),当未定义s
的值时,我会收到以下错误。
Notice: Undefined index: s in C:\xampp\htdocs\teaching\index.php on line 43
Notice: Undefined index: s in C:\xampp\htdocs\teaching\index.php on line 45
Notice: Undefined index: s in C:\xampp\htdocs\teaching\index.php on line 47
Notice: Undefined index: s in C:\xampp\htdocs\teaching\index.php on line 49
我希望脚本在声明了s
的值时调用特定的JavaScript函数,但如果没有声明任何值,则希望页面正常加载。
你能帮助我吗?
php.ini
中的error_reporting
。在生产服务器上,它不应该是E_ALL
。 - marioisset
函数来检查是否已正确接收。 - Anupam Haldkar