这不是一个真正的问题,但我需要知道为什么这个竞争。
Function onContentPrepareForm($form, $data)
$data = (object) $data;
if(isset($data->folder) && $data->folder != 'jfcore'
|| isset($data->name) && $data->name == 'plg_jfcore_jfcore'
|| isset($data->element) && $data->element == "jfcore" && in_array($data->folder, $this->cores)
|| isset($data->element) && $data->element == "jfcore" && in_array($data->folder, $this->third_cores))
return;
如果我不放 $ data =(object)$ data; 它会显示此错误尝试获取非对象的属性但是它已经是一个对象了。
如果我没有输入 isset($ data-> name)错误:未定义的属性:stdClass :: $ name
我的新功能
if(is_array($data))return true;
$data = (object) $data;
if(isset($data->folder) && $data->folder != 'jfcore'
|| isset($data->name) && $data->name == 'plg_jfcore_jfcore'
|| isset($data->element) && isset($data->folder) && $data->element == "jfcore" && in_array($data->folder, $this->cores)
|| isset($data->element) && isset($data->folder) && $data->element == "jfcore" && in_array($data->folder, $this->third_cores)
)
return true;
区
// We don't need system log for these plugins
if(isset($data->folder) && $data->folder != 'jfcore'
|| isset($data->name) && $data->name == 'plg_jfcore_jfcore'
|| isset($data->element) && $data->element == "jfcore" && isset($data->folder) && in_array($data->folder, $this->cores)
|| isset($data->element) && $data->element == "jfcore" && isset($data->folder) && in_array($data->folder, $this->third_cores)
|| empty((array)$data)
)
return;
对于返回或返回true,它取决于你的功能。