When learning Zend, you can see the following code: {code ...} I also made some attempts: var_dump (require & #039; test. php & #039;) 1. if no return statement exists, the output is: {code ...} 2. if the return statement is used, enter the return data: {code ...} may I ask PHP... the following code is displayed during Zend learning:
$config = new Zend_Config(require 'config.php');
I also made some attempts:
Var_dump (require 'test. php ')
1. If there is no return statement, the output is:
int(1)
2. If the return statement is used, the input is the return data:
...
What are the require and include mechanisms of PHP?
PS: although the PHP source code has been downloaded, I cannot find a clue at the moment.
Update
One test. php output. php
// output.phpoutput(require 'test.php');// or output(include 'test.php');function output($test) { var_dump($test);}
Scenario 1
// test.php 1return 123;
// output 1int(123)
Scenario 2
// test.php 2echo 123;
// output 2123int(1)
Case 3
// test.php 3echo 123;die;
// output 3123
Reply content:
The following code is displayed during Zend learning:
$config = new Zend_Config(require 'config.php');
I also made some attempts:
Var_dump (require 'test. php ')
1. If there is no return statement, the output is:
int(1)
2. If the return statement is used, the input is the return data:
...
What are the require and include mechanisms of PHP?
PS: although the PHP source code has been downloaded, I cannot find a clue at the moment.
Update
One test. php output. php
// output.phpoutput(require 'test.php');// or output(include 'test.php');function output($test) { var_dump($test);}
Scenario 1
// test.php 1return 123;
// output 1int(123)
Scenario 2
// test.php 2echo 123;
// output 2123int(1)
Case 3
// test.php 3echo 123;die;
// output 3123
According to the official explanation provided by php, the difference between require and include is that a fatal error is thrown when require encounters an error, while include only throws warning.
Require () is identical to include () failed t upon failure it will also produce a fatal E_COMPILE_ERROR level error. in other words, it will halt the script whereas include () only emits a warning (E_WARNING) which allows the script to continue.
See the include () documentation for how this works.
Their principle is: parse the file to be included according to HTML, and replace the output content with the position of the include statement.
There is a Laruence article here for reference to http://www.laruence.com/2010/05/04/14...