我的 Controller 中有以下方法,名为 HelloController,但没有任何 View :
public function actionGetContent(){
$output = Yii::app()->curl->get('http://www.example.com',array());
echo $output;
}
下面的行从网站获取内容:' http://www.example.com ' 使用 curl
Yii::app()->curl->get(websiteurl)
我尝试过这个:
<iframe src="<?php echo $this->createUrl('/work/15/Hello/GetContent');?>"></iframe>
之所以这样,是因为HelloController被放置在 protected 文件夹的模块中。我已经成功创建了路由规则,因此问题与路由无关。
有人可以建议我一种方法,可以将从上述 Controller 获取的内容放入没有 View 页面的 yii Controller 中的 iframe 中吗?
最佳答案
您是否尝试过获取最终的 iframe src url,并尝试在浏览器中打开该 url 看看是否正确?
关于php - 没有 View 的 Yii Controller Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17938414/