1.php将字符串以豆号隔开转换成数组
<?php
$text = "corn, broccoli, zucchini";
$vegetables = explode(", ", $text);
print_r($vegetables);
?>
2.IE浏览器默认使用IE10
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" />
3.implode() 函数把数组元素组合为一个字符串。
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode("<p></p>",$arr);
?>
4.php截取字符串函数
if(mb_strlen($chapter['cname'],"UTF8") > 52){$chapter['cname']= mb_substr($chapter['cname'],0,52,"UTF-8").'...';}
5.a 标签
<style type="text/css">
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
6.js字符串根据逗号转换成数组
data_name = 'a,b,c,d';
tags = data_name.split(',');
结果:
tags[0] = a
tags[1] = b
tags[2] = c
tags[3] = d
7.jQuery ajax
$.ajax({
type : "post",
url : "<?php echo base_url('pay/ajax_find_user');?>",
data :({username:username}),
async:false,
success:function(data){
data_name = data;
}
});
7.switch用法
switch(e.keyCode)
{
case 39: 程序代码
break;
}
8.可以用js提供的for循环来获得 js obj内容。
假设js对象为obj;
for(var i in obj){
document.write(i+":"+obj[i]);
}
9.js 计算一个参数,检查它是否为数值。
语法
isNaN()
isNaN(testValue)
参数
testValue : 你想要测试的值。
10.strtotime 时间转换成戳
strtotime('2012-11-05 00:00:00')
时间戳转时间
date('Y-m-d H:i:s',time())
11.php str_replace() 函数使用一个字符串替换字符串中的另一些字符。
<?php
echo str_replace("world","John","Hello world!");
?>
输出:Hello John!
12.js oninput使用 js赋值有问题
<input type="text" name="textfield" oninput="alert(this.value);" onpropertychange="alert(this.value)" />
13.css hack这个知识点是各浏览器定义不同
14.php urlencode 和urldecode 地址加密 转换
15.jquery 判断是否隐藏 is(":hidden")
16.用PHP写出显示客户端IP与服务器IP的代码:
打印客户端IP:echo $_SERVER[‘REMOTE_ADDR’]; 或者: getenv('REMOTE_ADDR');
打印服务器IP:echo gethostbyname("www.baidu.com")
17.写入文件
$string_start = "<?phpn"; $string_process = var_export($write_array, TRUE); $string_end = "n?>";
$string = $string_start.'$product='.$string_process.$string_end; //开始写入文件
file_put_contents(APPPATH.'/cache/product_cache.php', $string);
18.判断js有没有定义
if( typeof(document.mylist.length) != "undefined" ) {}
19.矫正时间和矫正乱码
date_default_timezone_set('Asia/Chongqing');
header("Content-Type: text/html; charset=UTF-8");
20.strpos() 函数
if(strpos($_POST['message'],'[/img]') !== false){
$imgstatus = true;
}else{
$imgstatus = false;
}
21 str_split()
str_split('123456');
结果为array(1,2,3,4,5,6);
22.引用赋值运算符 =&
$name = 'Judy';
$name_alias =& $name;
$name_alias = 'Jonathan';
print $name;
结果 Jonathan
23. mysql group by 排序问题 veeritsqe@gmail.com
SELECT com.* FROM `mhhome_comment` com INNER join (SELECT max(cid) as cid from mhhome_comment where uid=109681 and authorid !=109681 GROUP BY id,idtype) com1 on com.cid = com1.cid where com.uid=109681 and com.authorid !=109681 order by com.dateline desc;
<?php
$text = "corn, broccoli, zucchini";
$vegetables = explode(", ", $text);
print_r($vegetables);
?>
2.IE浏览器默认使用IE10
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" />
3.implode() 函数把数组元素组合为一个字符串。
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode("<p></p>",$arr);
?>
4.php截取字符串函数
if(mb_strlen($chapter['cname'],"UTF8") > 52){$chapter['cname']= mb_substr($chapter['cname'],0,52,"UTF-8").'...';}
5.a 标签
<style type="text/css">
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
6.js字符串根据逗号转换成数组
data_name = 'a,b,c,d';
tags = data_name.split(',');
结果:
tags[0] = a
tags[1] = b
tags[2] = c
tags[3] = d
7.jQuery ajax
$.ajax({
type : "post",
url : "<?php echo base_url('pay/ajax_find_user');?>",
data :({username:username}),
async:false,
success:function(data){
data_name = data;
}
});
7.switch用法
switch(e.keyCode)
{
case 39: 程序代码
break;
}
8.可以用js提供的for循环来获得 js obj内容。
假设js对象为obj;
for(var i in obj){
document.write(i+":"+obj[i]);
}
9.js 计算一个参数,检查它是否为数值。
语法
isNaN()
isNaN(testValue)
参数
testValue : 你想要测试的值。
10.strtotime 时间转换成戳
strtotime('2012-11-05 00:00:00')
时间戳转时间
date('Y-m-d H:i:s',time())
11.php str_replace() 函数使用一个字符串替换字符串中的另一些字符。
<?php
echo str_replace("world","John","Hello world!");
?>
输出:Hello John!
12.js oninput使用 js赋值有问题
<input type="text" name="textfield" oninput="alert(this.value);" onpropertychange="alert(this.value)" />
13.css hack这个知识点是各浏览器定义不同
14.php urlencode 和urldecode 地址加密 转换
15.jquery 判断是否隐藏 is(":hidden")
16.用PHP写出显示客户端IP与服务器IP的代码:
打印客户端IP:echo $_SERVER[‘REMOTE_ADDR’]; 或者: getenv('REMOTE_ADDR');
打印服务器IP:echo gethostbyname("www.baidu.com")
17.写入文件
$string_start = "<?phpn"; $string_process = var_export($write_array, TRUE); $string_end = "n?>";
$string = $string_start.'$product='.$string_process.$string_end; //开始写入文件
file_put_contents(APPPATH.'/cache/product_cache.php', $string);
18.判断js有没有定义
if( typeof(document.mylist.length) != "undefined" ) {}
19.矫正时间和矫正乱码
date_default_timezone_set('Asia/Chongqing');
header("Content-Type: text/html; charset=UTF-8");
20.strpos() 函数
if(strpos($_POST['message'],'[/img]') !== false){
$imgstatus = true;
}else{
$imgstatus = false;
}
21 str_split()
str_split('123456');
结果为array(1,2,3,4,5,6);
22.引用赋值运算符 =&
$name = 'Judy';
$name_alias =& $name;
$name_alias = 'Jonathan';
print $name;
结果 Jonathan
23. mysql group by 排序问题 veeritsqe@gmail.com
SELECT com.* FROM `mhhome_comment` com INNER join (SELECT max(cid) as cid from mhhome_comment where uid=109681 and authorid !=109681 GROUP BY id,idtype) com1 on com.cid = com1.cid where com.uid=109681 and com.authorid !=109681 order by com.dateline desc;