Home > Backend Development > PHP Tutorial > CodeIgniter2.2.0-The problem of failing to report an error when calling load in the controller, thinkphp calls the controller_PHP tutorial

CodeIgniter2.2.0-The problem of failing to report an error when calling load in the controller, thinkphp calls the controller_PHP tutorial

WBOY
Release: 2016-07-13 10:18:42
Original
1189 people have browsed it

CodeIgniter2.2.0-The problem of error reporting when calling load in the controller fails. Thinkphp calls the controller

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
Copy after login

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();
	}
}
Copy after login

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');
	}
Copy after login

That’s no problem.

After three years, I used codeigniter again and forgot many things. . .

When installing SQL2000, the error "For the MSSQLServer service, the service controller operation failed: 1726 Remote procedure call failed", how to solve it?

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 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.

How does the controller of the MVC architecture in php obtain the results returned by the bottom layer and directly call the error report

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}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/882091.htmlTechArticleCodeIgniter2.2.0-The problem of failure to call load in the controller and error reporting. thinkphp calls the controller and reports the following error: helloA PHP Error was encounteredSeverity: NoticeMessage: Undefined property...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template