开发者

$_GET problem in .html url

开发者 https://www.devze.com 2023-03-17 14:03 出处:网络
I have a url like this: http://开发者_运维百科mysite.com/contact.html?id=5 I want to get the value of id in the url in my php file. I try $_GET[\'id\'] but it doesn\'t return anything.

I have a url like this:

http://开发者_运维百科mysite.com/contact.html?id=5

I want to get the value of id in the url in my php file. I try $_GET['id'] but it doesn't return anything.

How can I get it?


The issue here is that the file is .html instead of .php, so it will not be parsed by PHP. If you want PHP to also work on .html, add this like to your .htaccess file:

AddType application/x-httpd-php .html

I wouldn't recommend it, though, since it's not really standard. In most cases, you're better off just renaming the file to .php.


The file you areaccessing in the URL is HTML. You need .PHP file to get the value from URL. Within HTML you can not get PHP Super Global value.

Try with

echo $_GET['id']

Or Check your getting GET values or not.

echo "<pre>";    
print_r($_GET);
echo "</pre>";


Try writing this echo $_REQUEST['id']


if you are using php code then it will be more recommendable that the extension will be .php not .html..

convert file in to php file and then try ..

i think it will work..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号