Warning: require_once(../models/Message.php) [function.require-once]: failed to open stream: No such
来源:互联网 发布:dnf 深度优化 编辑:程序博客网 时间:2024/05/16 17:24
( ! ) Fatal error: require_once() [function.require]: Failed opening required '../models/Message.php' (include_path='F:\xampp\htdocs\zendfrm\application/../library;F:\xampp\htdocs\zendfrm\library;.;F:\xampp\php\PEAR') in F:\xampp\htdocs\zendfrm\application\controllers\IndexController.php on line 2
Call Stack
#
Time
Memory
Function
Location
1
0.0029
340224
{main}( )
..\index.php:0
2
0.0390
2197240
Zend_Application->run( )
..\index.php:26
3
0.0390
2197240
Zend_Application_Bootstrap_Bootstrap->run( )
..\Application.php:366
4
0.0391
2197296
Zend_Controller_Front->dispatch( ???, ??? )
..\Bootstrap.php:97
5
0.0509
3507920
Zend_Controller_Dispatcher_Standard->dispatch( object(Zend_Controller_Request_Http)[14],object(Zend_Controller_Response_Http)[15] )
..\Front.php:954
6
0.0515
3507976
Zend_Controller_Dispatcher_Standard->loadClass( string(15) )
..\Standard.php:262
7
0.0526
3526248
include_once( 'F:\xampp\htdocs\zendfrm\application\controllers\IndexController.php' )
..\Standard.php:344
直接用require_once '../models/Message.php'; 报错
//此方法能解决路径不对的错误
方法1 require_once dirname(dirname(__FILE__)).'/models/Message.php';
方法2 require_once APPLICATION_PATH.'/models/Message.php';
原因如下:
echo __FILE__ ; // 取得当前文件的绝对地址,结果:D:\www\test.php
echo dirname(__FILE__); // 取得当前文件所在的绝对目录,结果:D:\www\
echo dirname(dirname(__FILE__)); //取得当前文件的上一层目录名,结果:D:\
<?php
require_once '../models/Message.php';
//此方法能解决路径不对的错误
//require_once dirname(dirname(__FILE__)).'/models/Message.php';
class IndexController extends Zend_Controller_Action
{
//这是初始化函数
public function init()
{
/* Initialize action controller here */
file_put_contents("d:/mylog.txt", __FILE__.date('y-m-d h:i:s')."init..\r\n",FILE_APPEND);
}
//控制器中的一个函数
public function indexAction()
{
// action body
file_put_contents("d:/mylog.txt", __FILE__.date('y-m-d h:i:s')."index..\r\n",FILE_APPEND);
//如果什么都没有些,相当于有以下一句话;用view/scripts/index/index.phtml
$messageModel=new Message();
$res=$messageModel->fetchAll();
echo '<pre>';
print_r($res);
echo '</pre>';
$this->render('index');
}
public function testAction(){
}
}
- Warning: require_once(../models/Message.php) [function.require-once]: failed to open stream: No such
- Laravel访问出错错误信息:`Warning: require(/vendor/autoload.php): failed to open stream: No such file or dire
- Warning: require(/www/101/eduask_net/ThinkPHP/Library/Think/Think.class.php): failed to open stream:
- PHP Warning: file_put_contents( ) [function.file-put-contents]: failed to open stream: Pe
- failed to open stream: No such file or directory in includes/src/Varien_Autoload.php on l
- include(Redis.php): failed to open stream: No such file or directory
- file_get_contents: failed to open stream: No such file or directory
- php出现Warning: file_put_contents,failed to open stream
- PHP Warning: file_get_contents failed to open stream解决办法
- PHP Warning: file_put_contents(".."):failed to open stream: Permission denied in...
- Advanced PHP Programming -- "require_once(Console/getopt.php) : failed to open stream" P129
- svnmanager 1.10 错误: require_once(VersionControl/SVN.php): failed to open stream...
- 今天遇到一个问题,很纠结include(authenticate.php): failed to open stream: No such file or directory
- Warning: session_start() [function.session-start]: open(/tmp/sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file
- Warning: fopen(http://192.168.1.12/shared/file/test.txt) [function.fopen]: failed to open stream: HT
- [function.fopen]: failed to open stream
- [ErrorException]fopen(./data/data.csv): failed to open stream: No such file or directory
- PHP 报错 Warning: Unknown: failed to open stream Fatal error: Unknown: Failed opening required
- 对范式的深入理解
- OpenGL编程指南第八章:绘制像素、位图、字体和图像
- TreeList 树形控件 实现带三种状态的CheckBox
- CUDA编程模型:存储器层次和异构编程
- Ubuntu下创建vim+Taglist+cscope+ctags组合编辑器
- Warning: require_once(../models/Message.php) [function.require-once]: failed to open stream: No such
- C类型提升
- 文本文件和二进制文件在存储时的区别
- windows上安装多个mysql
- ubuntu设置PATH变量的三种方法
- 脱机与连机数据库
- Unknown Source的出现及解决
- uva 10596 - Morning Walk
- Oracle 10g创建DBLink接连11g问题