简体   繁体   English

PHP错误:未定义索引

[英]PHP Error : Undefined Index

This is going to sound really stupid, but I cannot figure out why I am getting this error. 这听起来确实很愚蠢,但是我无法弄清楚为什么会出现此错误。

Notice: Undefined index: o in C:\\inetpub\\wwwroot\\webres\\OC_defaults.php 注意:未定义索引:o在C:\\ inetpub \\ wwwroot \\ webres \\ OC_defaults.php中

    $o = !empty($o) ? $o : $_REQUEST['o'];
    $ST_defaults["office"] = !empty($o) ? strtoupper($o) : $officeDefault;
    extract($ST_defaults);

Thanks, Jatin 谢谢,贾廷

$_REQUEST['o'] is not set. $ _REQUEST ['o']未设置。 .. a simple fix would be to add ..一个简单的解决方法是添加

if(!array_key_exists('o',$_REQUEST)){$_REQUEST['o']='';};

oh, also, don't use $_REQUEST, its bad practice, its lazy, where the data comes is unknown, corruption/overwriting is possible~ 哦,也不要使用$ _REQUEST,它的坏习惯,它的懒惰,数据来的不明,可能会损坏/覆盖〜

use $_COOKIE / $_POST / $_GET instead.. 使用$ _COOKIE / $ _POST / $ _GET代替。

o is not defined in the associative array $_REQUEST . o在关联数组$_REQUEST未定义。

You can check if it is defined by using isset($_REQUEST['o']) . 您可以使用isset($_REQUEST['o'])检查它是否已定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM