Requested scripts may not include parent directory
2015-10-27 13:33
302 查看
ZF中
<?php
/**
* zend framework
*/
class IndexController extends Zend_Controller_Action {
function indexAction() {
}
index.phtml
<?php echo $this->render('../../../common/header.phtml'); ?>
hello world
[/code]
整个异常如下:
Fatal error: Uncaught exception 'Zend_View_Exception' with message 'Requested scripts may not include parent directory traversal ("../", "..\" notation)' in D:\xyj\vancelle_beta\library\Zend\View\Abstract.php:966 Stack trace: #0 D:\xyj\vancelle_beta\library\Zend\View\Abstract.php(884): Zend_View_Abstract->_script('../../../common...') #1 D:\xyj\vancelle_beta\application\app4crm\default\views\scripts\index\index.phtml(1): Zend_View_Abstract->render('../../../common...') #2 D:\xyj\vancelle_beta\library\Zend\View.php(157): include('D:\xyj\vancelle...') #3 D:\xyj\vancelle_beta\library\Zend\View\Abstract.php(888): Zend_View->_run('D:/xyj/vancelle...') #4 D:\xyj\vancelle_beta\library\Zend\Controller\Action\Helper\ViewRenderer.php(912): Zend_View_Abstract->render('index/index.pht...') #5 D:\xyj\vancelle_beta\library\Zend\Controller\Action\Helper\ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript('index/index.pht...', NULL) #6 D:\xyj\vancelle_beta\library\Zend\Controller\Action\Helper\ViewRenderer.php in D:\xyj\vancelle_beta\library\Zend\View\Abstract.php on line 966
[/code]
经过百般google,发现原因是由于相对路径所对应的不止一个目录,肯定是为了安全,但是有时候又为了兼容性,我们需要禁用。
class IndexController extends Zend_Controller_Action {
function indexAction() {
$this->view->setLfiProtection(false);
}
[/code]
这是第一种方式。
第二种方式 就是最常见的
class IndexController extends Zend_Controller_Action {
function indexAction() {
$this->view->addScroptPath(APPLICATION_ROOT.'/common/');
}
index.phtml
<?php echo $this->render('header.phtml'); ?>
[/code]
转载于:https://my.oschina.net/u/1249595/blog/522576
相关文章推荐
- Error: parent directory is world writable but not sticky
- "/usr/src/linux/include" is not an existing directory时的VMware Tools的安装
- Xcode6.1 发布 出现 The ipa is invalid. It does not include a Payload Directory 错误
- Android问题集锦之一:android java.io.IOException: Parent directory of file is not writable: /sdcard/...
- Why is the window.close() works in IE browser but not FireFox? "Warning: Scripts may not close windo
- android java.io.IOException: Parent directory of file is not writable: /sdcard/...
- hadoop 问题 copyFromLocal: java.io.FileNotFoundException: Parent path is not a directory: /user/admini
- Xcode6.1 发布 出现 The ipa is invalid. It does not include a Payload Directory 错误
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- java.io.IOException: Parent directory of file is not writable
- window.close() doesn't work - Scripts may not close windows that were not opened by script.
- The directory '/home/XXX/.cache/pip/http' or its parent directory is not owned by the current user 出...
- Longhorn's Server Core installation option may does not include the server graphic user interface (GUI)
- The path "/usr/src/linux/include" is not an existing directory.解决方式
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- the propfind response did not include the requested properties
- Unable to find the requested .Net Framework Data Provider. It may not be installed
- [SSMS][Visual Studio] 解決 - Unable to find the requested .Net Framework Data Provider. It may not be installed
- 解决问题:The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the