久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么去掉指定字符之后的內(nèi)容

      兩種方法:1、用“substr_replace($str,"",strpos($str,"指定字符")+1)”語(yǔ)句,將指定字符位置后的內(nèi)容替換為空字符;2、用“substr($str,0,strpos($str,"指定字符")+1)”語(yǔ)句。

      php怎么去掉指定字符之后的內(nèi)容

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦

      php去掉指定字符之后內(nèi)容的兩種方法

      方法1:利用strpos()和substr_replace() 函數(shù)

      • 利用strpos()找到指定字符的位置,例字符d

      • 使用substr_replace()將指定字符后的內(nèi)容替換為空字符

      substr_replace()用于從指定位置開(kāi)始替換字符,而我們需要從指定字符后開(kāi)始替換,因此開(kāi)始替換的位置值為“指定字符的位置+1”。

      <?php header('content-type:text/html;charset=utf-8');    $str = "abcdefg"; echo "原字符串:".$str."<br>"; $index = strpos($str,"d"); $res = substr_replace($str,"",$index+1); echo "去除字符d后的內(nèi)容:".$res; ?>

      php怎么去掉指定字符之后的內(nèi)容

      方法2:利用strpos()和substr()函數(shù)

      • 使用strpos函數(shù)找到指定字符的位置,例字符e

      • 使用substr函數(shù)從字符串的開(kāi)頭截取至指定字符的位置

      <?php header('content-type:text/html;charset=utf-8');    $str = "abcdefg"; echo "原字符串:".$str."<br>"; $index = strpos($str,"e"); $res = substr($str,0,$index+1); echo "去除字符e后的內(nèi)容:".$res; ?>

      php怎么去掉指定字符之后的內(nèi)容

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)