Php solves the problem of getting special symbol parameters such as # in the URL,
For example, the following PHP code:
Copy codeThe Code is as follows:
<? Php
Echo $ _ GET ['key'];
?>
When url is http://test.com/c.php? When key = 999, the normal output is 999.
When url is http://test.com/c.php? Key = 9 #888, only output: 9
What should I do if I want to get 9 #888? You can only find a way to pass 9 #888 to the key.
I used the escape Function Code in JS to solve this problem. For more information, see.
Copy codeThe Code is as follows:
<Input placeholder = "input SN code" type = "text" id = "searchs" name = "searchs"/>
<A class = 'btn 'onclick = "searchsn ();" href = "javascript:;"> query </a>
<Script>
Function searchsn (){
Var keys = $ ('# searchs'). val ();
If (keys = ''){
Alert ('Enter the SN Code ');
Return false;
}
Keys = escape (keys); // encode the string, except for * @-_ + ./.
Window. location. href = 'C. php? Key = '+ keys;
}
</Script>
In PHP, how do I obtain the URL of the previous page?
$ _ SERVER ['HTTP _ referer']
Php retrieves webpage content from url
$ Url = zhidao.baidu.com/question/123456789.html
File_get_contents ($ url );