laravel 4 isset 中的非法偏移类型或为空
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26073014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel 4 Illegal offset type in isset or empty
提问by arual
I am using laravel 4 and trying to perform store of some data. I am having a problem that says:
我正在使用 laravel 4 并尝试执行一些数据的存储。我有一个问题说:
Illegal offset type in isset or empty
* Get the fully qualified location of the view.
*
* @param string $name
* @return string
*/
public function find($name)
{
if (isset($this->views[$name])) return $this->views[$name];
if (strpos($name, '::') !== false)
I can't understand where is this coming from. Anyone that can help me?
我无法理解这是从哪里来的。任何人都可以帮助我?
回答by aFreshMelon
Looks like the $name variable is undefined, are you sure you are setting it?
看起来 $name 变量未定义,您确定要设置它吗?
回答by Emiliano
the type of $name is something that is not a string or an integer
$name 的类型不是字符串或整数
check the var type in newer PHP (5.3>) this is more strict
检查较新的 PHP (5.3>) 中的 var 类型,这更严格
probably you are sending on $name an object or an array and don't realize
可能你在 $name 上发送一个对象或一个数组并且没有意识到
I could reproduce it sending an array ie
我可以复制它发送一个数组即
$name = array("test" => "testvalue");
$obj->arr[$name]; //this line give me an error because $name is an array
best Emiliano
最好的埃米利亚诺