用来表示一些如法输入的字符,或者输入后不明显,或者容易被编辑器替换的字符。
创新互联2013年至今,先为善左等服务建站,善左等地企业,进行企业商务咨询服务。为善左企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
例如:
\r表示回车
\n表示换行
\$表示一个$符号,直接在PHP的字符串里面写$容易被误会为变量。
对我来说Or the dream factory has always been the high standard, the screen exquisite detail, vivid characters vivid, touching story twists and turns, the most important thing is it in the most simple and easy to understand that the way of a token, that is - there is no shortcut to the world and Cheats, the only winning Famen is believe in themselves.
这个杀手不太冷
This film was absolutely amazing. I have spent hours re-watching various scenes and noticing all the perfection with which they are acted and directed. It's not the violence or action sequences that make this movie so great (although they are well done...), but rather moments like where Mathilda knocks on Leon's door. It would be so easy to just film the door opening, but instead we see light illuminating Natalie Portman's face, symbolizing something angelic. And the moment has so much more meaning.
在php中:
* 以单引号为定界符的php字符串,支持两个转义\'和\\
* 以双引号为定界符的php字符串,支持下列转义:
\n 换行(LF 或 ASCII 字符 0x0A(10))
\r 回车(CR 或 ASCII 字符 0x0D(13))
\t 水平制表符(HT 或 ASCII 字符 0x09(9))
\\ 反斜线
\$ 美元符号
\" 双引号
\[0-7]{1,3} 此正则表达式序列匹配一个用八进制符号表示的字符
\x[0-9A-Fa-f]{1,2} 此正则表达式序列匹配一个用十六进制符号表示的字符
举几个例子:
一个包含\0特殊字符的例子:
$str = "ffff\0ffff";
echo(strlen($str));
echo("\n");
for($i=0;$istrlen($str);$i++)echo("\t".ord($str{$i}));
echo("\n");
输出结果:
----------------------
9
102 102 102 102 0 102 102 102 102
替换特殊字符的例子
$str = "ffff\0ffff";
$str = str_replace("\x0", "", $str);
//或者用$str = str_replace("\0", "", $str);
//或者用$str = str_replace(chr(0), "", $str);
echo(strlen($str));
echo("\n");
for($i=0;$istrlen($str);$i++)echo("\t".ord($str{$i}));
echo("\n");
输出结果:
----------------------
8
102 102 102 102 102 102 102 102
八进制ascii码例子:
//注意,符合正则\[0-7]{1,3}的字符串,表示一个八进制的ascii码。
$str = "\0\01\02\3\7\10\011\08\8"; //这里的\8不符合要求,被修正为"\\8" (ascii为92和56)
echo(strlen($str));
echo("\n");
for($i=0;$istrlen($str);$i++)echo("\t".ord($str{$i}));
echo("\n");
输出结果:
----------------------
11
0 1 2 3 7 8 9 0 56 92 56
十六进制ascii码例子:
$str = "\x0\x1\x2\x3\x7\x8\x9\x10\x11\xff";
echo(strlen($str));
echo("\n");
for($i=0;$istrlen($str);$i++)echo("\t".ord($str{$i}));
echo("\n");
输出结果:
----------------------
10
0 1 2 3 7 8 9 16 17 255
编码
$new = htmlspecialchars("a href='test'Test/a", ENT_QUOTES);
echo $new; // a href='test'Test/a
解码
$str = 'pthis - "/p';
echo htmlspecialchars_decode($str);
// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款