Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP警告:WordPress(formatting.PHP)中的ltrim()问题_Php_Wordpress_Ubuntu_Error Handling - Fatal编程技术网

PHP警告:WordPress(formatting.PHP)中的ltrim()问题

PHP警告:WordPress(formatting.PHP)中的ltrim()问题,php,wordpress,ubuntu,error-handling,Php,Wordpress,Ubuntu,Error Handling,我在shell中写这篇文章 $url = str_replace( ' ', '%20', ltrim( $url ) ); sudo tail-100/var/log/apache2/error.log 我看到了这一点 $url = str_replace( ' ', '%20', ltrim( $url ) ); [Sun Feb 14 09:42:06.873076 2021][php7:warn][pid 1968][client 82.222.237.83:36955]PHP警告

我在shell中写这篇文章

$url = str_replace( ' ', '%20', ltrim( $url ) );
sudo tail-100/var/log/apache2/error.log

我看到了这一点

$url = str_replace( ' ', '%20', ltrim( $url ) );

[Sun Feb 14 09:42:06.873076 2021][php7:warn][pid 1968][client 82.222.237.83:36955]PHP警告:ltrim()希望参数1是字符串,第4314行的/var/www/html/wp includes/formatting.PHP中给出的对象

function esc_url( $url, $protocols = null, $_context = 'display' ) {
    $original_url = $url;

    if ( '' === $url ) {
        return $url;
    }

    $url = str_replace( ' ', '%20', ltrim( $url ) );
    $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );

    if ( '' === $url ) {
        return $url;
    }

    if ( 0 !== stripos( $url, 'mailto:' ) ) {
        $strip = array( '%0d', '%0a', '%0D', '%0A' );
        $url   = _deep_replace( $strip, $url );
    }

    $url = str_replace( ';//', '://', $url );
[Sun Feb 14 09:42:06.873149 2021][php7:warn][pid 1968][client 82.222.237.83:36955]PHP警告:ltrim()希望参数1是字符串,第4314行的/var/www/html/wp includes/formatting.PHP中给出的对象

function esc_url( $url, $protocols = null, $_context = 'display' ) {
    $original_url = $url;

    if ( '' === $url ) {
        return $url;
    }

    $url = str_replace( ' ', '%20', ltrim( $url ) );
    $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );

    if ( '' === $url ) {
        return $url;
    }

    if ( 0 !== stripos( $url, 'mailto:' ) ) {
        $strip = array( '%0d', '%0a', '%0D', '%0A' );
        $url   = _deep_replace( $strip, $url );
    }

    $url = str_replace( ';//', '://', $url );

我将转到相关代码。-->/var/www/html/wp includes/formatting.php,第4314行

function esc_url( $url, $protocols = null, $_context = 'display' ) {
    $original_url = $url;

    if ( '' === $url ) {
        return $url;
    }

    $url = str_replace( ' ', '%20', ltrim( $url ) );
    $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );

    if ( '' === $url ) {
        return $url;
    }

    if ( 0 !== stripos( $url, 'mailto:' ) ) {
        $strip = array( '%0d', '%0a', '%0D', '%0A' );
        $url   = _deep_replace( $strip, $url );
    }

    $url = str_replace( ';//', '://', $url );
第4314行

$url = str_replace( ' ', '%20', ltrim( $url ) );
我不明白。我的错误页面充满了这些。尽管我做了研究,我还是搞不懂。你能帮我吗

注:Ubuntu 20.04,Wordpress

健康的日子,
致以最诚挚的问候。

调用函数esc_url()时使用的$url是对象而不是字符串。您可以使用gettype()或print\r()进行确认。debug_backtrace()可能有助于确定从何处进行这些调用。

该函数是使用对象调用的,而不是使用字符串调用的。。。然而,这里没有看到它是如何被称为。。。。可能会有帮助,但我没有使用与内容相关的Pods wordpress插件。此外,不幸的是,我无法完全阅读解决方案。它写得很复杂@贝伦德