This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(function(){ | |
//禁用页面右键菜单 | |
$(document).bind("contextmenu",function(e){ | |
return false; | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
//例子1 :href="http://"的超链接将会在新窗口打开链接 | |
$('a[href^="http://"]').attr("target","_blank"); | |
//例子2 :rel="external"的超链接将会在新窗口打开链接 | |
$("a[rel$='external']").click(function(){ | |
this.target = "_blank"; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取get的值 | |
function getUrlArgs(_name,url){ | |
var url = window.location.href; | |
if(new RegExp(".+"+_name+"=([^&]+).*","gi").test(url)){ | |
return RegExp.$1; | |
}else{ | |
return ""; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//判断美国那个时间段是否为夏令时 | |
function is_dst($timestamp) | |
{ | |
$timezone = date('e'); //获取当前使用的时区 | |
date_default_timezone_set('US/Pacific-New'); //强制设置时区 | |
$dst = date('I',$timestamp); //判断是否夏令时 | |
date_default_timezone_set($timezone); //还原时区 | |
return $dst; //返回结果 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//获取当月第一天和最后一天 | |
private function getthemonth($date) | |
{ | |
$firstday = date('Y-m-01', strtotime($date)); | |
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day")); | |
return array($firstday, $lastday); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function removeEmoji($text) { | |
$clean_text = ""; | |
// Match Emoticons | |
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; | |
$clean_text = preg_replace($regexEmoticons, '', $text); | |
// Match Miscellaneous Symbols and Pictographs | |
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//随机插入到某个位置 $arr是一个多远数组,先统计他值的个数 | |
$num = count($arr); | |
$randomNumUlist = mt_rand(1,$num); | |
$i = 0; | |
//插入随机数 | |
foreach ($arr as $k => $v) { | |
$i++; | |
if($i == $randomNumUlist){ | |
array_splice($arr,$i,0,array($dataUlist)); //这里就是诀窍所在 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getkm(){ | |
if ($this->request->getGet()) { | |
ini_set('display_errors','On'); | |
error_reporting(E_ALL); | |
$master = Factory::loadDB('master'); | |
$kemiObj = Factory::loadModel('KemiCard',$master); | |
$filename = '/mnt/www/qiumi/Api/Controller/kemi.xls'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
nl2br(); // \n to <br/> | |
addslashes(); stripslashes(); //对数据库操作时,转义特殊字符 | |
chop(); //除去字符串右边空格 | |
trim(); //除去字符串中所有空格 | |
ltrim(); //除去字符串左边空格 | |
htmlspecialchars(); //转换'$','"','<','>'为相应的html实体 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type: application/json; charset=UTF-8"); | |
define("HEADER_ACCESS","*"); | |
header('Access-Control-Allow-Origin:' . HEADER_ACCESS); | |
header('Access-Control-Allow-Credentials: true'); | |
header('Access-Control-Allow-Methods: GET, POST'); | |
echo jsonencode(array()); | |
die(); |
OlderNewer