Rumah > Soal Jawab > teks badan
在Yii2源码文件vendor/yiisoft/yii2/web/View.php中看到这个方法,里面用到strstr函数,strstr这样用不是有问题吗???求解!
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();
}
几个self变量的值都是形如:
const PH_HEAD = '<![CDATA[YII-BLOCK-HEAD]]>';