php include() implementation method with parameters_PHP tutorial

WBOY
Release: 2016-07-13 17:15:55
Original
1797 people have browsed it

I didn’t succeed in inlcude with parameters before. Today I saw an article and solved it decisively. For example, I can include('a.php?site=www.bKjia.c0m') and then call the a.php page. It can be obtained directly via $_GET['a'];.

Detailed explanation of specific methods


Example: Suppose you need to call inc.php?para=3 in index.php,

inc.php

The code is as follows
代码如下 复制代码

Copy code

代码如下 复制代码


The following writing method cannot get the correct result:
代码如下 复制代码

index.php

The code is as follows
Copy code
代码如下 复制代码


With a slight change, define the $_GET variable before include, and it will run normally:

index.php

The code is as follows Copy code

If the allow_url_include function is turned on in php.ini, you can use the include url method: index.php
The code is as follows Copy code
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, in order to ensure security, most servers turn off the allow_url_include function, so it depends on the situation. http://www.bkjia.com/PHPjc/628731.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/628731.htmlTechArticleI have not succeeded in inlcude with parameters before. I saw an article today and solved it decisively. If I can do this include('a.php?site=www.111cn.net') and then directly $_G... when calling the a.php page

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!