现在的位置: 首页 > 综合 > 正文

平时细节(php)

2017年11月22日 ⁄ 综合 ⁄ 共 933字 ⁄ 字号 评论关闭

本篇文章用来记录平时的一些细节问题,随时更新……

1.<a href="tencent://message/?uin=446473669">dd</a> 此链接可以调用本地QQ聊天程序uin后面就是所要聊天的对象

2.用get传值为汉字时,在谷歌浏览器下不会出现乱码,而在ie浏览器下则会出现,把所要传的值用urlencode()函数编码下则在ie浏览器地址栏中显示的是编码后的值,而在谷歌浏览器地址栏则依旧显示的是汉字

<a href="t.php?id=<?php echo urlencode("你好");?>">test</a>

3.页面输出时的格式控制nl2br(htmlspecialchars(“string”))

4.

<?php 
print_r($_POST['arr']).'<br>';
echo $_POST['arr'][0];
?>
<form method="post" action="">
<input type="text" name="arr[]"/>
<input type="text" name="arr[]"/>
<input type="text" name="arr[]" />
<input type="submit"  />
</form> 

5.count() 括号里只能是* 或者是单个字段,多个字段不能

6.PHP strstr() 函数

string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )
Returns part of haystack string starting from and including the first occurrence of needle to the end of haystack.
Note:
This function is case-sensitive. For case-insensitive searches, use stristr().(大小写敏感)
Note:
If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead.

【上篇】
【下篇】

抱歉!评论已关闭.