PHP消息:PHP警告:strpos()期望参数1为字符串


PHP message: PHP Warning: strpos() expects parameter 1 to be string,

Wordpress Site

警告:

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

下面是functions.php的第4101 - 4103行

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

这意味着你传递给strpos($file)的第一个参数不是字符串,而是一个数组。做一个var_dump($file)在调用strpos之前的一行,看看你实际得到的值是什么。

如果你有$files数组直接从文件形式,$file['tmp']可以是。但最简单的方法是使用var_dump。