Home > Article > Backend Development > CodeIgniter2.2.0-The problem of failing to report an error when calling load in the controller, thinkphp calls the controller_PHP tutorial
and reports the following error:
hello A PHP Error was encountered Severity: Notice Message: Undefined property: Test::$load Filename: controllers/test.php Line Number: 9 Fatal error: Call to a member function view() on a non-object in D:\xampp\htdocs\citest\application\controllers\test.php on line 9
The code is as follows:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); class Test extends CI_Controller{ public function test() {<br /> //此处是引发错误的根源 echo 'hello'; } public function index() { $this->load->view('test/index'); } public function about() { $this->load->view('test/about'); } protected function test1() { echo 'test protected function'; } private function hello() { echo 'hello,ci'; } public function test2() { $this->test1(); echo '<br/>'; $this->hello(); } }
Do you see what’s wrong? Because I rewrote the constructor of the test controller, the public method and __construct method with the same class name have the same function. After rewriting, the instantiation in the CI_Controller parent class is gone, and you must instantiate it yourself. Become.
In addition to removing methods with the same name as the class, there are also methods as follows:
public function test() { echo 'hello'; parent::__construct(); } public function index() { $this->load->view('test/index'); }
That’s no problem.
After three years, I used codeigniter again and forgot many things. . .
An example of MSSQLSERVER service failure to start
Symptom
There is no response when starting MSSQLServer using SQL Server Service Manager, but there is no problem when starting MSDTC. When starting using 09cea0f39e737032e498d36335bfbdee in the control panel, the prompt "Unable to start the MSSQLServer service. Error 2140: A Windows NT internal error occurred."
Reason
After asking the operator, I learned that it was in Enterprise In the Manager, a parameter in the startup parameters was deleted in the SERVER properties, causing the SQL SERVER to fail to start
Solution
In ms-dos, enter c:\mssql7\binn and execute
sqlservr -d c:\mssql7\data\master.mdf -e c:\mssql7\log\errorlog -l c:\mssql7\data\mastlog.ldf
After about a minute, when When the prompt message "Using 'xpstar.dll' version '1998.11.13' to execute extended stored procedure 'sp_MSgetversion'." appears, it means that it has started normally. At this time, you cannot close the ms-dos window, open Enterprise Manager, and open the SERVER properties. Startup parameters in the window, add parameters in the Startup Parameters window:
-dc:\mssql7\data\master.mdf
-ec:\mssql7\log\errorlog
-lc:\ mssql7\data\mastlog.ldf
Then close the MS-DOS window and use SQL Server Service Manager to start the service.
The above is repaired on SQL7. For SQL2000, the fault phenomenon and operation method are basically the same. The difference is that the prompt information in MS-DOS mode is different, and the file path is changed. It is c:\program files\microsoft sql server\mssql, and the rest are the same.
Haha Your jump is executed inside the class, and calling methods from outside will jump internally. If you want to customize it, change the method in the class to the following location
/**************You can only jump here********* ******************/
header("Location:../View/admin_home.php"); This location does not need to be changed to return true
header("Location:../View/user_login.php?loginProving=passWordError"); This location does not need to be changed to return false;
The place submitted above is here
/****** *******Want to handle the jump here******************************/
$LoginProving -> userNameProving ($userName,$passWord); Change to $result= $LoginProving -> userNameProving($userName,$passWord);
This way you can determine whether the login is successful if( $result){successful jump link}else {Error jump link}