Include is a function that calls a file in php. by default, it cannot be like include (aphp? Id1) in this way, the following describes how to solve the problem that include does not contain parameter calls.
Include is a function that calls a file in php. by default, it cannot be like include (a. php? Id = 1) in this case, the following describes how to solve the problem of using include without parameters.
Sometimes, based on some special requirements, you need to use the include () method in PHP to call a file that independently provides services in the project. If the called file uses the GET method to import data, you need some tips.
For example, suppose that inc. php needs to be called in index. php? Para = 3, inc. php:
The following statement cannot get the correct result, index. php:
With a slight flexibility, you can define the $ _ GET variable before include to run: index. php:
-
- $ _ GET ['para'] = 3;
- Include dirname (_ FILE _). '/inc. php;?>
If the allow_url_include function is enabled in php. ini, you can use the include url method: index. php.
Setting method: in php. ini, find the following line and change it to On:
; Whether to allow include/require to open URLs (like http: // or ftp: //) as files.
Allow_url_include = On
However, to ensure security, most servers disable the allow_url_include function.