用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2775|回复: 10
收起左侧

[已解决] failed to open stream

[复制链接]
发表于 2017-3-15 14:59:06 | 显示全部楼层 |阅读模式
一个简单的注册界面,老是报这个错,求大神帮忙Warning: include(D:\wamp\www\CodeIgniter\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in D:\wamp\www\CodeIgniter\system\core\Exceptions.php on line 268
发表于 2017-3-15 15:24:11 | 显示全部楼层
贴代码看一下,这个报错的意思是,你的代码出错了,然后 CI 想显示错误页面,但找不到你的错误页面,所以报了这个错误。其根本原因是你的代码可能出错了。
 楼主| 发表于 2017-3-15 15:35:23 | 显示全部楼层
Hex 发表于 2017-3-15 15:24
贴代码看一下,这个报错的意思是,你的代码出错了,然后 CI 想显示错误页面,但找不到你的错误页面,所以报 ...

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Regist extends CI_Controller{
        public function __construct(){
                // 在构造函数中自动加载
                parent::__construct();
                $this->load->model('user_model','user'); //自动加载模型类
        }
        public function index(){
               
                $this->load->helper('form');
                $data['tit']="注册";
                //$this->load->view('admin/sign-up.html','$data');
                $this->load->library('form_validation');
                $status=$this->form_validation->run('regist');
                if($status){       
                        $data=array(
                                'email'=>$this->input->post('email'),
                                'username'=>$this->input->post('username'),
                                'password'=>$this->input->post('password')
                                );
                        $this->user->add($data);
                        success('regist/show','添加成功');
                }else{
                        $this->load->view('admin/sign-up.html','$data');
                }
        }       
}
发表于 2017-3-15 15:51:07 | 显示全部楼层
极有可能他把application\views下的errors文件夹删除了。
 楼主| 发表于 2017-3-15 16:10:36 | 显示全部楼层
xgdd1987 发表于 2017-3-15 15:51
极有可能他把application\views下的errors文件夹删除了。

是没有这个文件夹,但好像没删过
 楼主| 发表于 2017-3-15 16:17:21 | 显示全部楼层
xgdd1987 发表于 2017-3-15 15:51
极有可能他把application\views下的errors文件夹删除了。

还真是删了那个文件夹,但现在报这个错
A PHP Error was encountered

Severity: 8192

Message: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

Filename: mysql/mysql_driver.php

Line Number: 135

Backtrace:

File: D:\wamp\www\CodeIgniter\application\controllers\regist.php
Line: 6
Function: __construct

File: D:\wamp\www\CodeIgniter\index.php
Line: 315
Function: require_once
发表于 2017-3-15 16:19:58 | 显示全部楼层
唯~愛羅 发表于 2017-3-15 16:17
还真是删了那个文件夹,但现在报这个错
A PHP Error was encountered

这个报错很明显了,别用 mysql 扩展了,改用 mysqli,在 config/databases.php 里改。
 楼主| 发表于 2017-3-15 16:21:36 | 显示全部楼层
Hex 发表于 2017-3-15 16:19
这个报错很明显了,别用 mysql 扩展了,改用 mysqli,在 config/databases.php 里改。 ...

恩恩,刚改好了,然后又有这个错
Unable to load the requested file: admin/sign-up.html
刚开始学什么都不会
发表于 2017-3-15 16:24:38 | 显示全部楼层
唯~愛羅 发表于 2017-3-15 16:21
恩恩,刚改好了,然后又有这个错
Unable to load the requested file: admin/sign-up.html
刚开始学什么 ...

views 目录下缺 admin/sign-up.html 这个文件。

要先仔细看手册,多思考,多实践。
 楼主| 发表于 2017-3-15 19:28:52 | 显示全部楼层
Hex 发表于 2017-3-15 16:24
views 目录下缺 admin/sign-up.html 这个文件。

要先仔细看手册,多思考,多实践。 ...

好的,谢谢大神

本版积分规则