I added a method list {code ...} OK, an error is reported, and then the suffix {code...} is configured ...} add the suffix {code...} to the system Keyword Method ...} OK. I will open the browser again and you will think about what will happen. Maybe it will continue to report the error of illegal index operation, but there is actually no error...
I added a method list.
";} Public function index () {// index () method public // echo'
Hello Think php'; // $ config = C (''); // read all configuration items // dump ($ config); // dump () is the ThinkPHP function used to print the echo "index of the Variable
";} Public function _ after_index () {// defines the rear Operation echo" index. after
";}Public function list () {// note that the system keyword will return an error echo" list ";}}
OK, an error is reported.
Then configure the suffix
'Configuration value'/* database settings */'db _ type' => 'mysql', // Database TYPE 'db _ host' => 'localhost ', // server address 'db _ name' => 'jike ', // database NAME 'db _ user' => 'user ', // username 'db _ pwd' => '123', // password 'db _ port' => '123 ', // port 'db _ prefix' => 'jikexueyuan ', // database table PREFIX 'Load _ EXT_CONFIG' => 'user, upload ', /* application settings */'Action _ SUFFIX '=> 'action', // operation method SUFFIX );
Add a suffix to the method of the system keyword
"; } public function index(){// $config=C('');// dump($config); echo "index
"; } public function _after_index(){ echo "index.after
"; } public function listAction(){ echo "list"; }}
OK. I will open the browser again.
Let's think about what will happen.
Yes, it should continue to report errors.
Invalid index operation
However, no error is reported indicating that the index operation is invalid.
And it runs normally.
You can see that the front and rear are also normal ???
Why?
How is it different from the course?
I don't know if I have neglected anything.
I did not find out why I checked it carefully.
Get started
Reply content:
I added a method list.
";} Public function index () {// index () method public // echo'
Hello Think php'; // $ config = C (''); // read all configuration items // dump ($ config); // dump () is the ThinkPHP function used to print the echo "index of the Variable
";} Public function _ after_index () {// defines the rear Operation echo" index. after
";}Public function list () {// note that the system keyword will return an error echo" list ";}}
OK, an error is reported.
Then configure the suffix
'Configuration value'/* database settings */'db _ type' => 'mysql', // Database TYPE 'db _ host' => 'localhost ', // server address 'db _ name' => 'jike ', // database NAME 'db _ user' => 'user ', // username 'db _ pwd' => '123', // password 'db _ port' => '123 ', // port 'db _ prefix' => 'jikexueyuan ', // database table PREFIX 'Load _ EXT_CONFIG' => 'user, upload ', /* application settings */'Action _ SUFFIX '=> 'action', // operation method SUFFIX );
Add a suffix to the method of the system keyword
"; } public function index(){// $config=C('');// dump($config); echo "index
"; } public function _after_index(){ echo "index.after
"; } public function listAction(){ echo "list"; }}
OK. I will open the browser again.
Let's think about what will happen.
Yes, it should continue to report errors.
Invalid index operation
However, no error is reported indicating that the index operation is invalid.
And it runs normally.
You can see that the front and rear are also normal ???
Why?
How is it different from the course?
I don't know if I have neglected anything.
I did not find out why I checked it carefully.
Get started
I wonder if you have understood the error:
For example, if 'Action _ SUFFIX '=> 'act' is set, the Operation Method for accessing the add operation of a module corresponds to the read module class is changed from the original add method to the addAct method.
This means that if you add an Action and no Action after the index, you will find the index method in the actual controller, because the entry file will match whether there is an Action string based on your method name, if it cannot be found, the corresponding method of the string name will be found!
This avoids the public error of special names.