CodeIgniter PHP 显示值截取-值
<?php echo $value['haoma']; ?>
-----------------------
上面显示的值:057188885281-001
怎么截取-后面001
大虾求解
[解决办法]
$str = '057188885281-001';
$str = $value['haoma'];
if (stripos($str, '-') !== FALSE) {
echo substr($str, stripos($str, '-') + 1);
} else {
echo $str;
}
$arr = explode('-', '057188885281-001');
echo $arr[1];