Includ and require are all loading the other pages to the current page, but the difference is, if the require is not found, or the included pages have errors will not be executed downPHP include ' form.php '; require ' aasdfa.php ';?
Detailed descriptionFor example, suppose that inc. php needs to be called in index. php? Para = 3,Inc. php The code is as follows:Copy code The following statement cannot produce the correct result:Index. php The code is as follows:Copy code
The Include and require statements are also used to reference files to PHP code.There is a huge difference between include and require:Include statement references a file and PHP cannot find it, the script will continue to executeThe script
In many cases, the company has one type of code that needs to be deployed uniformly, such as: 1. Database configuration file 2. Unified Framework of the company 3. Other uniform program codefor this part of the code we need to unify the
Practice the truth, write a simple file PHP file include a JS file, the implementation of no error or warning information, and see the contents of the file containing JS is printed. It is therefore concluded that the include target file can be of
Let's say two ways:
1 defines a string variable that holds the list of files to be loaded. Then foreach loads.
Copy Code code as follows:
$a = '/a.class.php;/util/b.class.php;/util/c.class.php ';
$b =
Server-side include (small industry) used to create features, headers, footers, or content that will be reused for multiple pages.Server-side IncludeYou can insert the contents of the file into the PHP file before the server executes it, with the
Recently found that PHP running automatically load class functions always timed out, tracking php slow query log, found that the program card in the Include a class file unexpectedly timeout.
Initial location is IO response Timeout, hard drive read
[Php] the core features of include, include_once, require, and require_once are the same, it is equivalent to directly copying the code of the target webpage.
Basically, if you do not consider performance, you can use include, include_once,
Phpinclude and include_once, require and require_once
* Include () and include_once ()* Require () and require_once ()1. the include () function reads the specified file and runs the program.Example: include ('/home/me/myfile ');
The program code in
Let's talk about two methods:1) define a string variable to save the list of files to be loaded. Then foreach loads. Copy codeThe Code is as follows:$ A = '/a. class. php;/Util/B. class. php;/Util/c. class. php ';$ B = '/d. php;/e. class. php;/f.
Recently found that PHP run automatically load class functions always time out, tracking the PHP slow query log, found that the application card in the Include a class file when the time out.Initial positioning is the IO response timeout, hard disk
Include_once is similar to require_once. It is used to check whether the contained file has been included. If so, it will not be executed. Otherwise, it will be included again. the reason for this is that if you have clarified include and require.
1. Intermediate Program include. incCopy codeThe Code is as follows:Include_once 'include/Base. php ';$ Path = '';$ Url = isBase: decrypt (urlDecode ($ _ SERVER ['query _ string']);Parse_str ($ url); // GET the variable passed through the url
: This article mainly introduces the include usage of php. if you are interested in the PHP Tutorial, refer to it. I am used to the C ++ syntax and think that include contains some header files. PHP's include function is more than that.
1.
I thought I had dug a gold mine. After talking with heige, I found that it could only be used on the Win32 platform, reducing the power of this BUG, basically not causing much harm, this is because there are too few PHP applications on the WIN32
The include structure of php can be used to include and run specified files. However, the file path is truncated in some cases. For example, the path contains characters with an ascii value of 0. First, the Demo code is as follows:
$ S = $ _ GET
Recently found that PHP run automatically load class functions always time out, tracking the PHP slow query log, found that the application card in the Include a class file when the time out.
Initial positioning is the IO response timeout, hard
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.