Home >Backend Development >PHP Tutorial >yii2 - 关于PHP函数strstr的用法

yii2 - 关于PHP函数strstr的用法

WBOY
WBOYOriginal
2016-06-06 20:26:061178browse

在Yii2源码文件vendor/yiisoft/yii2/web/View.php中看到这个方法,里面用到strstr函数,strstr这样用不是有问题吗???求解!

<code>public function endPage($ajaxMode = false)
{
    $this->trigger(self::EVENT_END_PAGE);

    $content = ob_get_clean();

    echo strtr($content, [
        self::PH_HEAD => $this->renderHeadHtml(),//返回字符串
        self::PH_BODY_BEGIN => $this->renderBodyBeginHtml(),//返回字符串
        self::PH_BODY_END => $this->renderBodyEndHtml($ajaxMode),//返回字符串
    ]);

    $this->clear();
}</code>

几个self变量的值都是形如:

<code>const PH_HEAD = '';</code>

回复内容:

在Yii2源码文件vendor/yiisoft/yii2/web/View.php中看到这个方法,里面用到strstr函数,strstr这样用不是有问题吗???求解!

<code>public function endPage($ajaxMode = false)
{
    $this->trigger(self::EVENT_END_PAGE);

    $content = ob_get_clean();

    echo strtr($content, [
        self::PH_HEAD => $this->renderHeadHtml(),//返回字符串
        self::PH_BODY_BEGIN => $this->renderBodyBeginHtml(),//返回字符串
        self::PH_BODY_END => $this->renderBodyEndHtml($ajaxMode),//返回字符串
    ]);

    $this->clear();
}</code>

几个self变量的值都是形如:

<code>const PH_HEAD = '';</code>

看仔细了,人家写的是

http://php.net/strtr

这个,而不是你问的

http://php.net/strstr

这个

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn