Warning: strlen() expects parameter 1 to be string, array given in file… in line

强颜欢笑 提交于 2019-12-11 06:34:57

问题


I have this error:

Warning: strlen() expects parameter 1 to be string, array given in /includes/functions/general.php on line 159

Line 159 is:

if ((strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y')) {

Could you help me solving this problem?


回答1:


strlen() only works for strings. From the strlen() documentation:

strlen() returns NULL when executed on arrays, and an E_WARNING level error is emitted.


If you have an array, use count() to count the elements:

if (count($value) > 0)


来源:https://stackoverflow.com/questions/50143398/warning-strlen-expects-parameter-1-to-be-string-array-given-in-file-in-li

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!