2016-11-06 97 views
-2

WordPress站點PHP消息:PHP警告:strpos()預計參數1是字符串,

警告:

AH01071: Got error 'PHP message: PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/vhosts/mysite.com/httpdocs/wp-includes/functions.php on line 4102\nPHP message: PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/vhosts/mysite.com/httpdocs/wp-includes/functions.php on line 4102\nPHP message: PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/vhosts/mysite.com/httpdocs/wp-includes/functions.php on line 4102\nPHP message: PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/vhosts/mysite.com/httpdocs/wp-includes/functions.php on line 4102\n', referer: mysite 

這裏是線4101 - 4103的functions.php的

function validate_file($file, $allowed_files = '') { 
    if (false !== strpos($file, '..')) 
     return 1; 
+4

您收到該消息是因爲_strpos()期望參數1是字符串數組given_。 – Federkun

回答

0

這意味着你傳遞給strpos($ file)的第一個參數不是一個字符串,而是一個數組。在調用strpos之前查看你實際擁有的價值之前,請先執行一行 var_dump($file)

如果你有直接從文件格式的$ files數組,$ file ['tmp']是否可以。但最簡單的方法是var_dump。

相關問題