當前位置:菜譜大全網 - 菜譜大全 - PHP像這樣截取字符串代碼:

寫壹個:

階級人士

{

public $ str

功能人員(str)

{

$ this-& gt;str = $ str

}

公共函數名($len)

{

$ n = substr($ this-& gt;str,0,$ len);

e

PHP像這樣截取字符串代碼:

寫壹個:

階級人士

{

public $ str

功能人員(str)

{

$ this-& gt;str = $ str

}

公共函數名($len)

{

$ n = substr($ this-& gt;str,0,$ len);

e

PHP像這樣截取字符串代碼:

寫壹個:

階級人士

{

public $ str

功能人員(str)

{

$ this-& gt;str = $ str

}

公共函數名($len)

{

$ n = substr($ this-& gt;str,0,$ len);

echo $ n;

返回$ n;

}

}

$ product =新人(iconv ("UTF-8 "," GBK ","阿朵古力齊齊哈哈拉瓦沙"));

$ product-& gt;姓名(8);//執行後輸出“阿朵古力”(每個漢字占用兩個字節)。