Home > Backend Development > PHP Tutorial > PHP solution to obtain parameters with special symbols such as # in the URL, _PHP tutorial

PHP solution to obtain parameters with special symbols such as # in the URL, _PHP tutorial

WBOY
Release: 2016-07-13 10:19:39
Original
1210 people have browsed it

Solution for php to obtain parameters with special symbols such as # in the URL,

For example the following PHP code:

Copy code The code is as follows:

echo $_GET['key'];
?>

When the url is http://test.com/c.php?key=999, the normal output is: 999
When the url is http://test.com/c.php?key=9#888, it can only output: 9
What I want to get is 9#888, so what should I do? We can only find a way to pass 9#888 to the key.

I solved this problem by encoding and passing the escape function in JS. Friends in need can refer to it.

Copy code The code is as follows:


Query
<script><br> Function searchsn() {<br>          var keys = $('#searchs').val();<br>            if (keys == '') {<br> alert('Please fill in the SN code');<br>               return false;<br> }<br> keys = escape(keys); //Encode the string, except * @ - _ + . / these characters <br>           window.location.href = 'c.php?key=' + keys;<br> }<br> </script>

How to get the URL of the previous page in PHP?

$_SERVER['HTTP_REFERER']

php gets web content from url

$url = zhidao.baidu.com/question/123456789.html
file_get_contents($url);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/873342.htmlTechArticlephp solution for obtaining parameters with special symbols such as # in the URL, such as the following PHP code: Copy code code As follows: php echo $_GET['key']; When the url is http://test.com/c.phpkey=999,...
Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template