首页 > 解决方案 > 使用include替换iframe php错误

问题描述

我正在尝试使用 include 替换我的 php 中的 iframe,但出现错误

include(/yii2cta/frontend/web/commenti/view?pc=71): failed to open stream: No error

我不想使用 ajax 或 jquery 加载,因为如果我在互联网上搜索后这样做,我的 javascript 代码会损坏,我发现我可以在包含和 file_get_contents 的 php 代码中使用 include 或“file_get_contents”错误我的代码是:

<?php 
$url = Url::to(['/commenti/view', 'pc' => $model->post_id]);
include($url);
?>

网址是

/yii2cta/frontend/web/commenti/view?pc=71

如果我使用 iframe 它可以工作但我不想使用 iframe 但我不知道是否可以使用 include 或 file_get_contents ?

标签: phpyii2-advanced-appphp-7.2

解决方案


推荐阅读