Home > Backend Development > PHP Tutorial > PHP CodeIgniter 截取数据解决思路

PHP CodeIgniter 截取数据解决思路

WBOY
Release: 2016-06-13 11:46:03
Original
796 people have browsed it

PHP CodeIgniter 截取数据



15018903588-006


在中间有一横杠,怎么根据中间的横杠前面数据截出,然后在根据横杠把后面的数据截出


求大虾代码贴出
------解决方案--------------------
判断工号是否有“-”
if (strpos($value['homa'],'-')){
    $last = substr($value['homa'],0,strrpos($value['homa'],'-'));
    $next = substr(strstr($value['homa'],'-'),1);
}else{
    $value['homa'];
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template