1,时间戳转换为时间
{$vo.post_time|date="Y-m-d H:i",###}
2,js中获取服务器地址:
var const_url=window.location.protocol+"//"+window.location.host+"/index/personalweb/article";
3,去除html标签
{if condition="mb_strlen($vo['content']) gt 70"} {php}$content=strip_tags($vo['content']);{/php} {$content|mb_substr=0,70}··· {else /} {php} echo strip_tags($vo['content']);{/php} {/if}
4,php中字符串的截取
$grade = substr($detail['class_name'], 0, 4);//截取前四个字符
$class = substr($detail['class_name'], 7, -3);//去掉最后三个字符,去掉前七个字符
$class = substr($detail['class_name'], 0, strlen($detail['class_name'])-1);//去掉最后一个字符
5,js中将数组转换为js数据
var arr = [1,2,3,4];
var json = JSON.stringify(arr);
console.log(json);
6,js中判断是否为正数
if((/^(\+|-)?\d+$/.test( page_num ))&&page_num>0){
location.href=U('applyadmin/Articlebz/list_recommend')+"&p="+page_num;
}else{
ui.error('非法页码,请输入正确页码');
return false;
}