I have not succeeded in the problem of inlcude with parameters. Today I saw an article about this. For example, I can include (\ 'a. php? Site = www. bKjia. c0m \ '). Then, you can call $ _ GET [\ 'a \'] on the. php page.
Detailed description
For example, suppose that inc. php needs to be called in index. php? Para = 3,
Inc. php
The Code is as follows: |
Copy code |
<? Php echo $ _ GET ['para'];?> |
The following statement cannot produce the correct result:
Index. php
The Code is as follows: |
Copy code |
<? Php include dirname (_ FILE _). '/inc. php? Para = 3';?>
|
With a slight flexibility, you can define the $ _ GET variable before include to run normally:
Index. php
The Code is as follows: |
Copy code |
<? 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
The Code is as follows: |
Copy code |
<? Php include 'HTTP: // www.yoururl.com/inc.php? Para = 3';?> |
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.