Created
June 30, 2015 03:54
-
-
Save guoxiangke/2715e399c1e165a84de0 to your computer and use it in GitHub Desktop.
//正则表达式获取URL参数 preg get URL parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //正则表达式获取URL参数 preg get URL parameter | |
| //http://stackoverflow.com/questions/11706986/php-getting-url-variable-with-preg-match | |
| $subject = "http://www.mysite.com?id=05&name=johnny"; | |
| $pattern = '/id=[0-9A-Za-z]*/'; //$pattern = '/id=[0-9]*/'; if it is only numeric. | |
| preg_match($pattern, $subject, $matches); | |
| print_r($matches); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/v=[0-9A-Za-z_-]*/ add _ -
http://www.techairlines.com/useful-youtube-url-tricks/
http://www.makeuseof.com/tag/10-youtube-url-tricks-you-should-know-about/
length = 11