doujiexin1136
2014-05-02 18:06
浏览 116
已采纳

未定义的常量问题

I was working on my site yesterday and all the content was appearing fine. Then today, I refreshed and something has broken.

I'm getting this error on the homepage:

Notice: Use of undefined constant Page - assumed 'Page' in includes\survey_inside.php on line 19  
Notice: Use of undefined constant Listing - assumed 'Listing' in includes\survey_inside.php on line 20

When I look on line 19 the code is:

$strPage = $_REQUEST[Page];
if($_REQUEST[mode]=="Listing"){

Like I said, everything worked fine yesterday, and I didn't change these lines. I've been looking around for several hours and am stuck. Any thoughts on how to proceed with figuring out what happened?

Thanks!

图片转代码服务由CSDN问答提供 功能建议

我昨天在我的网站上工作,所有内容都显得很好。 然后今天,我刷新了,有些东西坏了。

我在主页上收到此错误:

 注意:使用undefined 常量页面 - 第19行中包含\ survey_inside.php的假设'Page'注意:使用未定义的常量列表 - 在第20行包含\ survey_inside.php中假设'列表'
   
  
 

当我在第19行看时,代码是:

  $ strPage = $ _REQUEST [Page]; 
if($ _ REQUEST [mode] ==“  “){
   
 
 

就像我说的,昨天一切正常,我没有改变这些线。 我一直在寻找几个小时,我被卡住了。 关于如何着手搞清楚发生了什么的任何想法?

谢谢!

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dptiq46022 2014-05-02 18:10
    已采纳

    When you want to access an array like $_REQUEST, you have to use some key (string value). In this case you are calling $_REQUEST[Page] and $_REQUEST[mode].

    Since Page and mode are not constant values, you have to use it as a string, so:

    $strPage = $_REQUEST['Page'];
    
    if ($_REQUEST['mode'] == "Listing") { }
    
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题