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

yii2 - 关于PHP函数strstr的用法

WBOY
Release: 2016-06-06 20:26:06
Original
1159 people have browsed it

在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>
Copy after login
Copy after login

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

<code>const PH_HEAD = '';</code>
Copy after login
Copy after login

回复内容:

在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>
Copy after login
Copy after login

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

<code>const PH_HEAD = '';</code>
Copy after login
Copy after login

看仔细了,人家写的是

http://php.net/strtr

这个,而不是你问的

http://php.net/strstr

这个

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template