【发布时间】:2013-06-09 16:58:25
【问题描述】:
E_NOTICE : type 8 -- Undefined index: $realName -- at line 26 *这是我遇到的错误。
这是我的功能
function stats($label, $realName){
global $decode;
echo ("<p>".$label.$decode['stats']['$realName']."</p>");
};
我这样称呼它:
stats("Life: ", "life");
返回:
E_NOTICE : type 8 -- Undefined index: $realName -- at line 26
Life:
如果我在实际代码中将 $realName 更改为 life,它将正确输出。 示例: 寿命:56305
我做错了什么?我知道这与我使用 $realName 的方式有关。
【问题讨论】:
-
你可能想要
echo ("<p>".$label.$decode['stats'][$realname']."</p>");(去掉$realname周围的引号) -
@iblamefish 这就是我刚才所说的;你只删除了一个单引号
标签: php function indexing decode