求教ZF中的setScriptPath
blessdyb
2009-12-26
开始学习zf,看看Beginning Zend Framework来入门。在其中碰到了下面的问题,请各位帮忙解答,谢谢。
我用的是zf 1.8.0的环境,用Zend_Tools生成了AccountController,其中有一个updateAction,在update.phtml 中我引用了includes/header.phtml这个公共文件。目录结构如下: -controllers -AccountController -views -scripts -accounts -update.phtml -includes -header.phtml 下面是AccountController与update.phtml的代码: <?php class AccountController extends Zend_Controller_Action { // public function updateAction() { $view=new Zend_View(); $view->addScriptPath(APPLICATION_PATH."/views/scripts/account"); $view->render("update.phtml"); } } <?=$this->doctype('XHTML1_STRICT')?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <?=$this->headTitle('blessdyb.com – Update Info')?> </head> <body> <?php $this->render('../includes/header.phtml')?> <h3>Update My Profile</h3> <form action="saveprofile" method="POST"> <table width="500" border="0"> <tr> <td>Username: </td> <td><input type="text" name="username" value="<?=$this->username?>"/></td> </tr> <tr> <td>Email: </td> <td><input type="text" name="email" value="<?=$this->email?>"/></td> </tr> <tr> <td>Password: </td> <td><input type="password" name="password" value="<?=$this->password?>"/></td> </tr> <tr> <td colspan="2"> <input type="submit" value=" Update my account! " /> </td> </tr> </table> </form> </body> </html> 运行http://localhost/account/update后就会提示 Requested scripts may not include parent directory traversal ("../", "..\" notation) 如果我不在update.phtml中调用header.phtml这个文件,那就没有问题,这里用到了setScriptsPath,是不是这块的设置有问题? |
|
blessdyb
2009-12-26
自问自答了,原来是setScritpPath的问题
只要为header.phtml再加上一个setScriptPath就可以了 |
相关讨论
相关资源推荐
- Spring Roo 1.1.0.M2 Released
- A Big Hop Forward: Spring Roo 1.1.0 Is Released!
- 使用 Spring Roo 创建应用程序并在 Google App Engine 上部署
- New Milestone Update for SpringSource Tool Suite: 2.3.2.M2
- Using SpringSource Tool Suite 2.3.3.M1 with Roo and GWT
- This week in Spring: July 26th, 2011
- This week in Spring: June 14th, 2011
- This Week in Spring - May 22nd, 2012
- springsecurity3和JCaptcha的整合
- soockte操作手册