1 , functions to escape strings/addcslashes(str,ch) and stripcslashes(str);
<code><span>$str</span> = <span>" hello,word "</span>; <span>echo</span><span>$str</span>.<span>"<br/>"</span>; <span>echo</span> trim(<span>$str</span>).<span>"<br/>"</span>; <span>$str</span> = <span>"@黎明hello,word@"</span>; <span>echo</span> ltrim(<span>$str</span>).<span>"<br/>"</span>; <span>echo</span> rtrim(<span>$str</span>); </code>
<code><span>$str</span> = <span>"select * from data where name ='黎明'"</span>; <span>$strm</span> = addcslashes(<span>$str</span>, <span>"'"</span>); <span>$strl</span> = stripcslashes(<span>$str</span>); <span>echo</span><span>$str</span>.<span>"<br/>"</span>; <span>echo</span><span>$strm</span>.<span>"<br/>"</span>; <span>echo</span><span>$strl</span>;</code>
The above introduces the PHP string function (1), including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.