本文介绍了CakePHP - 成功后,我可以重定向到视图的特定DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我想知道是否可以重定向到特定的< DIV> 在视图中。

I wanted to find out if it is possible to redirect to a specific <DIV> within a VIEW.

基本上,用户在视图中单击提交并且提交成功后,我想将用户重定向到特定的<$ c $

Basically, after the user clicks submit in the view and the submission is a success I would like to redirect the user to a specific <DIV ID=> within a view.

这是我目前使用的代码

$this->redirect(array('action'=>'view',$id));

这会将用户重定向到。不过,我想将它们转移到 http:// cakephpexample / articles / view / 4#comments

This would redirect the user to http://cakephexample/articles/view/4. However I would like to have them transferred to http://cakephpexample/articles/view/4#comments.

如何使用重定向选项实现?

How can that be accomplished with the redirect option?

谢谢你,

推荐答案

您尝试过 $ this-> redirect(array('action'=>'view',$ id ,'#comments'));

这篇关于CakePHP - 成功后,我可以重定向到视图的特定DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 20:39