一个php截取指定字符串之间的字符串的类
class get_c_str { var $str; var $start_str; var $end_str; var $start_pos; var $end_pos; var $c_str_l; var $contents; function get_str($str,$start_str,$end_str){ $this->str = $str; $this->start_str = $start_str; $this->end_str = $end_str; $this->start_pos = strpos($this->str,$this->start_str)+strlen($this->start_str); $this->end_pos = strpos($this->str,$this->end_str); $this->c_str_l = $this->end_pos - $this->start_pos; $this->contents = substr($this->str,$this->start_pos,$this->c_str_l); return $this->contents; } }?>
<?php $get_c_str = new get_c_str; echo $get_c_str -> get_str('[123456789]','[',']'); ?>
相关推荐
amberom 2020-08-03
有梦就能实现 2020-06-10
缘起宇轩阁 2019-12-21
xcguoyu 2019-10-29
缘起宇轩阁 2019-10-28
amberom 2019-10-25
yangguangdblu 2019-06-18
drise 2013-11-25
wqzbxh 2012-03-23
xianzhe 2019-06-30
zhangkala 2013-06-08
技术渣 2016-10-07
Phplayers 2019-06-28
wangdoudou0 2015-07-07
spinachcqb 2019-06-27
会写code的凳子哥 2013-11-21
静心斋 2013-08-23
技术渣 2012-08-07
会写code的凳子哥 2012-07-06