php:如何从url字符串中查找变量的结果
我想从以下url字符串中查找变量: 这是我的字符串:php:如何从url字符串中查找变量的结果,php,Php,我想从以下url字符串中查找变量: 这是我的字符串: $var = "http://localhost/trans/site/index#ads=10" 如何从该字符串中获取$ads? <?php $var = "http://localhost/trans/site/index#ads=10"; echo $ads = parse_url($var, PHP_URL_FRAGMENT); ?> 输出:ads=10 <?php $var = "http://local
$var = "http://localhost/trans/site/index#ads=10"
如何从该字符串中获取$ads
?
<?php
$var = "http://localhost/trans/site/index#ads=10";
echo $ads = parse_url($var, PHP_URL_FRAGMENT);
?>
输出:ads=10
<?php
$var = "http://localhost/trans/site/index#ads=10";
$ads = parse_url($var, PHP_URL_FRAGMENT);
echo $ten = (explode("=",$ads)[1]);
?>
输出:10
输出:ads=10
<?php
$var = "http://localhost/trans/site/index#ads=10";
$ads = parse_url($var, PHP_URL_FRAGMENT);
echo $ten = (explode("=",$ads)[1]);
?>
产出:10