Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Yii使用html id呈现页面_Php_Yii - Fatal编程技术网

Php Yii使用html id呈现页面

Php Yii使用html id呈现页面,php,yii,Php,Yii,正如我所知,渲染是移动到另一个页面 例如: $this->render('index'); // move to index.php 在普通HTML中,我们可以简单地根据自己的需要执行此操作,例如: $this->render('index'); // move to index.php 单击index.php#tab1将移动到位置tab1。。。伊伊呢 我尝试了$this->render('index#tab1')但不起作用。有什么建议吗?谢谢我试过这个,效果很好 $this-&

正如我所知,渲染是移动到另一个页面

例如:

$this->render('index'); // move to index.php
在普通HTML中,我们可以简单地根据自己的需要执行此操作,例如:

$this->render('index'); // move to index.php
单击
index.php#tab1
将移动到位置
tab1
。。。伊伊呢


我尝试了
$this->render('index#tab1')但不起作用。有什么建议吗?谢谢

我试过这个,效果很好

$this->redirect(array('/site/index','#'=>'tab1'));

谢谢

render()
方法将呈现完整的
视图/{controller}/index.php
。我想你说的是链接,而不是
render
method.@Justinas但是移动到索引并不是按链接单击。。。这个链接只是我的例子来解释我的想法want@TheSmile:URL的
#
部分只能在客户端使用,因此Yii无法处理此问题…@TheSmile如果单击链接
index.php#tab1
,浏览器将跳转到该位置。Yii(作为PHP框架)将只向用户输出视图文件
renderPartial()
只能用于输出视图的单个部分,但它不会产生“跳转”效果。@不能通过Yii或任何其他基于服务器端的内容执行此任务。