


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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...
