色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

一個PHP的String類代碼

使用方法:
復制代碼 代碼如下:
$s ='中國';
$os = new String( $s );
echo $os->decode('gbk') ,'';
echo $os->decode('gbk')->encode('md5'),'';

代碼
復制代碼 代碼如下:
class String extends stdClass
{
private $_val ='';
public function __construct( $str ='' )
{
$this->_val = $str;
}
public function __toString()
{
return $this->_val;
}
public function encode( $coder )
{
$coder ='encode_' . $coder;
if( method_exists( $this, $coder ) )
{
return $this->$coder();
}else{
return $this;
}
}
public function decode( $coder )
{
$coder ='decode_' . $coder;
if( method_exists( $this, $coder ) )
{
return $this->$coder();
}else{
return $this;
}
}
private function encode_md5()
{
return new String( md5( $this->_val ) );
}
private function decode_gbk()
{
return new String( iconv('GBK','UTF-8', $this->_val ) );
}
}

php技術一個PHP的String類代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 卓尼县| 玉林市| 安宁市| 顺平县| 通城县| 旌德县| 蒲江县| 讷河市| 信丰县| 株洲市| 东乌珠穆沁旗| 元江| 清镇市| 建平县| 鹿邑县| 比如县| 东阳市| 南丰县| 县级市| 鹤山市| 景泰县| 富裕县| 徐水县| 弥勒县| 眉山市| 安丘市| 雷州市| 天台县| 神池县| 古浪县| 尼玛县| 增城市| 沁水县| 怀安县| 蕲春县| 辉南县| 新干县| 兖州市| 宝丰县| 周口市| 枣庄市|