如何只取字符串里面的数字 函数 急 $murl=http://mynewtzt.com/detail.php?id=217665就用函数调sid(murl)调用出来就是只取了217665这个数字.function sid()要怎么写啊?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function sid($str) { return preg_replace('/[^\d]/', '', $str);}$murl = 'http://mynewtzt.com/detail.php?id=217665';echo sid($murl); $murl="http://mynewtzt.com/detail.php?id=217665";function sid($murl) { $url = parse_url($murl); if (isset($url['query'])) { $id = explode('=',$url['query']); return $id[1]; }else { return 0; }}echo sid($murl); 请大家看一下全是ut8编码为什么还乱码? PHP实例!?新手上路 php的页面静态化感觉有点局限。 php写的象棋对弈游戏,谁要 大哥大姐们来帮帮俺~~~急急急急急急---------在线等 linux下安装php时,为何不能编译? 使用apache和postgres数据库建站的高手进来看看!技术讨论 http://xxxxx.html?song_id=xxxxxxx 困惑中,高分求解. 求问 PHP清空session时老是显示session_destory()未定义函数,请教下大佬们,代码如下。 奇怪的注销问题 求助高手帮我把这段httpd.in代码转换成.htaccess代码
return preg_replace('/[^\d]/', '', $str);
}$murl = 'http://mynewtzt.com/detail.php?id=217665';
echo sid($murl);
function sid($murl) {
$url = parse_url($murl);
if (isset($url['query'])) {
$id = explode('=',$url['query']);
return $id[1];
}else {
return 0;
}
}
echo sid($murl);