0

I'm a beginner at CakePHP, and for a project at work I'm running into a maddening problem. I have a paginated list of links with each linking to a view in cakephp:

link1: <a href="<?php echo $SITE_URL>/users/show_chart/<?php echo $id0;?>">See Chart</a>
link2: <a href="<?php echo $SITE_URL>/users/show_chart/<?php echo $id1;?>">See Chart</a>
link3: <a href="<?php echo $SITE_URL>/users/show_chart/<?php echo $id2;?>">See Chart</a>

Pretty simple. I'm inheriting the project from a previous team, so there's some code I don't understand yet, but I think it's pretty clear that it should be calling the "show_chart" action function in the "users_controller" class.

Inside that function I've tried various things like:

function show_chart($id) {
echo "<pre>";
echo $id;
echo "</pre>";
echo "You'd better show me something";
exit;
} 

But when I click on one of the links, it performs the action as though I never edited the action at all in the controller. My little debug message never shows up. The program even works as usual when I comment the "show_chart" function out wholesale.

My first thought was that there's an HTTP redirect somewhere, but I can't find anything amiss. My second thought was that this action is somehow cached somewhere and the function is getting bypassed in favor of the caching. Any thoughts? Anyone?

4

2 回答 2

0

检查路由器。这将准确地告诉您该 URL 调用了哪个操作和控制器。

于 2013-03-11T22:26:25.267 回答
0

原则上,你是对的。/users/show_chart/ 转到用户控制器和展示车功能。

在您的情况下,有用的是下载您拥有的所有代码并在某个 IDE 中创建一个项目,以便您可以搜索整个项目。我一直将 eclipse 与 CakePHP 一起使用,但存在许多替代方案。最有可能的是,您可以从 Notepad++ 开始并搜索 google 以查看如何查看文件夹中的所有文件。然后,只需搜索“show_cart”即可!

除此之外,它可能在几个地方,具体取决于您之前团队的质量...... .htaccess、路由器、引导程序、用户控制器、随机 php 脚本......

祝你好运!

于 2013-03-11T22:28:51.913 回答