当前位置:Gxlcms > PHP教程 > CodeIgniterPHP显示值截取-值解决方案

CodeIgniterPHP显示值截取-值解决方案

时间:2021-07-01 10:21:17 帮助过:5人阅读

CodeIgniter PHP 显示值截取-值



-----------------------
上面显示的值:057188885281-001
怎么截取-后面001

大虾求解

分享到: 更多


------解决方案--------------------

$str = '057188885281-001';
$str = $value['haoma'];
if (stripos($str, '-') !== FALSE) {
echo substr($str, stripos($str, '-') + 1);
} else {
echo $str;
}

------解决方案--------------------
2、
$arr = explode('-', '057188885281-001'); 
echo $arr[1];

------解决方案--------------------

人气教程排行