????: 在此章節(jié)內(nèi),PHP能通過(guò)函數(shù)進(jìn)行許多字符串的操作。字符可以有諸多輸出方式,能夠過(guò)濾與填充、大小寫轉(zhuǎn)換以及特殊字符的解析,還能有查找與替換、URL、JSON處理及其諸多有用的功能,能夠熟練掌握和使用這些函數(shù)能能更好完成相應(yīng)的功能。<?php /** * Created by PhpStorm.  
在此章節(jié)內(nèi),PHP能通過(guò)函數(shù)進(jìn)行許多字符串的操作。字符可以有諸多輸出方式,能夠過(guò)濾與填充、大小寫轉(zhuǎn)換以及特殊字符的解析,還能有查找與替換、URL、JSON處理及其諸多有用的功能,能夠熟練掌握和使用這些函數(shù)能能更好完成相應(yīng)的功能。
<?php /** * Created by PhpStorm. * User: hp * Date: 2019/4/1 * Time: 21:20 **/ $str1 = 'We have agents looking for you'; echo substr($str1,-15,7),'<br>'; $str2 = 'ipnx.cn'; echo strstr($str2,'p'),'<br>'; echo strstr($str2,'.',true),'<br>'; echo strpos($str2,'php'),'<hr>'; echo str_replace('www','https://www',$str2),'<br>'; echo str_ireplace('PHp','baidu',$str2),'<br>'; echo substr_replace($str2,'com',8,3),'<br>'; echo substr_replace($str2,'',4,4),'<hr>'; $str3 = 'http://www.google.com/'; echo urlencode($str3),'<br>'; $str4 = urlencode($str3); echo '<a href="'.$str4.'">谷歌瀏覽器</a>','<br>';//無(wú)法訪問(wèn) echo '<a href="'.urldecode($str4).'">谷歌瀏覽器</a><hr>';//可以訪問(wèn) $str5 = '震波女'; echo json_encode($str5),'<br>'; $str6 = ['name'=>'Daisy','age'=>27,'actor'=>'汪可盈']; echo json_encode($str6),'<br>'; $str7 = '{"a":527,"b":814,"c":1228}'; $res = json_decode($str7); echo '<pre>',var_export($res),'</pre><br>';
?? ???:西門大官人?? ??:2019-04-02 11:15:59
???? ??:程序案例不錯(cuò),最好寫一下使用到的函數(shù)的說(shuō)明或注釋