Flex 布局基础
Flex是Flexible Box的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性。任何一个容器都可以指定为Flex布局。Webkit内核的浏览器,必须加上-webkit前缀。
Flex是Flexible Box的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性。任何一个容器都可以指定为Flex布局。Webkit内核的浏览器,必须加上-webkit前缀。
判断是否为第一个
dedecms的arclist循环中,判断如果是第一个li,则添加固定的css,否则不加。
{dede:arclist row=4 flag='p'}
<li [field:global name=autoindex runphp="yes"](@me==1)? @me="class=on":@me="";[/field:global]>[field:global.autoindex/]</li>
{/dede:arclist}
修改文件include/arc.archives.class.php文件,function GetPreNext($gtype='')
函数修改为:
function GetPreNext($gtype='')
{
$rs = '';
if(count($this->PreNext)<2)
{
$aid = $this->ArcID;
$preR = $this->dsql->GetOne("Select id From `#@__arctiny` where id<$aid And arcrank>-1 And typeid='{$this->Fields['typeid']}' order by id desc");
$nextR = $this->dsql->GetOne("Select id From `#@__arctiny` where id>$aid And arcrank>-1 And typeid='{$this->Fields['typeid']}' order by id asc");
$next = (is_array($nextR) ? " where arc.id={$nextR['id']} " : ' where 1>2 ');
$pre = (is_array($preR) ? " where arc.id={$preR['id']} " : ' where 1>2 ');
$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath
from `#@__archives` arc left join #@__arctype t on arc.typeid=t.id ";
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow))
{
$mlink = GetFileUrl($preRow['id'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],
$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);
$mobile_mlink = "/m/view.php?aid=".$preRow['id'];
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
$this->PreNext['mobile_pre'] = "上一篇:<a href='$mobile_mlink'>{$preRow['title']}</a> ";
$this->PreNext['preimg'] = "<a href='$mlink'><img src=\"{$preRow['litpic']}\" alt=\"{$preRow['title']}\"/></a> ";
}
else
{
$this->PreNext['pre'] = "上一篇:没有了 ";
$this->PreNext['mobile_pre'] = "上一篇:没有了 ";
$this->PreNext['preimg'] ="<img src=\"/templets/default/images/nophoto.jpg\" alt=\"对不起,没有上一图集了!\"/>";
}
if(is_array($nextRow))
{
$mlink = GetFileUrl($nextRow['id'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],
$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']);
$mobile_mlink = "/m/view.php?aid=".$nextRow['id'];
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
$this->PreNext['mobile_next'] = "下一篇:<a href='$mobile_mlink'>{$nextRow['title']}</a> ";
$this->PreNext['nextimg'] = "<a href='$mlink'><img src=\"{$nextRow['litpic']}\" alt=\"{$nextRow['title']}\"/></a> ";
}
else
{
$this->PreNext['next'] = "下一篇:没有了 ";
$this->PreNext['mobile_next'] = "下一篇:没有了 ";
$this->PreNext['nextimg'] ="<a href='javascript:void(0)' alt=\"\"><img src=\"/templets/default/images/nophoto.jpg\" alt=\"对不起,没有下一图集了!\"/></a>";
}
}
if($gtype=='pre')
{
$rs = $this->PreNext['pre'];
}
else if($gtype=='preimg'){
$rs = $this->PreNext['preimg'];
}
else if($gtype=='mobile_pre'){
$rs = $this->PreNext['mobile_pre'];
}
else if($gtype=='next')
{
$rs = $this->PreNext['next'];
}
else if($gtype=='mobile_next')
{
$rs = $this->PreNext['mobile_next'];
}
else if($gtype=='nextimg'){
$rs = $this->PreNext['nextimg'];
}
else
{
$rs = $this->PreNext['pre']." ".$this->PreNext['next'];
}
return $rs;
}
在手机网站详情页模板内,将调用上一页、下一页标签插入。
<ul class="am-pagination blog-pagination">
<li>{dede:prenext get='mobile_pre'/}</li>
<div style="clear:both;"></div>
<li>{dede:prenext get='mobile_next'/}</li>
</ul>
最近在数据采集过程中遇到aspx __doPostBack数据加载方式,利用火车头(免费版)或php采集程序无有效方法采集,于是手动编写chrome浏览器插件自动点击“下一页”翻页抓取网址数据,继而用火车头采集数据。
不能将富文本对象转换为数组。一般我们在上传导Excel的时候会出现此问题,问题的原因是Excel表格中有富文本对象。
解决方法1: $student['actual_residence']=(string)$objPHPExcel->getActiveSheet()->getCell("M".$i)->getValue();
原理:将富文本对象转换为string类型。
解决方法2:
其实在PHPExcel中已经有转换的方法写好了,直接调用即可。 $objPHPExcel->getActiveSheet()->getCell("M".$i)->getValue()->__toString();
当然,最简单的方式那就直接把excel表格格式化样式即可。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>GO</title>
</head>
<body>
<h1>WAITING ...</h1>
</body>
<script>
window.onload=function(){
getLocation();
go();
}
function getLocation(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition);
}else{
x.innerHTML="Geolocation is not supported by this browser.";
}
}
function showPosition(position){
// alert(position.coords.latitude+","+position.coords.longitude);
}
function go(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(comeOn);
}else{
x.innerHTML="Geolocation is not supported by this browser.";
}
}
function comeOn(position){
window.location.href="http://api.map.baidu.com/direction?origin=latlng:"+position.coords.latitude+","+position.coords.longitude+"|name:我的位置&destination=风筝博物馆&mode=driving®ion=潍坊&output=html&src=zhinizhiwo.com|icecry";
}
</script>
</html>
最近计划入坑Laravel,无奈php>5.6,现用wamp为5.5.12,升级。
1.下载php5.6.30 VC11 x64 Thread Safe,http://windows.php.net/download/
2.wamp/bin/php目录创建php5.6.30目录并复制文件
3.复制php5.5.12下的php.ini、phpForApache.ini、wampserver.conf至php5.6.30目录 下,并将php.ini、phpForApache.ini中的5.5.12全部替换成5.6.30
注:也可复制php.ini-development文件,修改后保存为php.ini及phpForApache.ini
4.删除wamp\bin\apache\apache2.4.9\bin下的php.ini文件
5.wamp中重启服务,此时php版本只显示5.5.12,点击重启,便可出现5.6.30版本,选择。
备注:php5.6以上版本,curl拓展开启问题
php.ini中 ;extension=php_curl.dll 前的;已经去除,但仍提示curl未开启
解决办法:将php安装目录下的libssh2.dll复制到apache的bin目录,并重新启动apache
同源策略(Same origin policy)
同源策略,它是由Netscape提出的一个著名的安全策略。现在所有支持JavaScript 的浏览器都会使用这个策略。所谓同源是指,域名,协议,端口相同。
那问题来了,如何合法规避浏览器的同源策略呢
跨域资源共享(CORS)
服务器端添加 Header 头信息,指定允许访问的源
以 PHP 语言为例
header("Access-Control-Allow-Origin: http://www.codefun.cn");
header("Access-Control-Allow-Credentials: true");
例如,上面的字段值将允许来自 http://www.codefun.cn 的请求