层叠选择器:
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 | |
/** | |
* 检验药品本位码 | |
* 规则: | |
* 全国产品与服务统一代码由 13位数字本体代码和 1位数字校验码组成 | |
* 第一步:按照由右至左的顺序,确定代码中包括校验码在内的各位代码的代码位置序号(校验码的GB 18937- 2003 | |
* 代码位置序号为 1,其他由右至左依次为 2,3,4,14) ; | |
* 第二步:从代码位置序号为2的位置开始,求所有偶数位代码的和; | |
* 第三步:将第二步的和乘以3; |
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
class Test{ | |
public $a; | |
public $b; | |
public function __construct($a) { | |
$this->a = $a; | |
} | |
} | |
//对象转数组,使用get_object_vars返回对象属性组成的数组 | |
function objectToArray($obj){ | |
$arr = is_object($obj) ? get_object_vars($obj) : $obj;print_r($arr); |
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
var mode="zhuan"; | |
function encode(obj,btn){ | |
if(mode=="zhuan"){ | |
obj.value=obj.value.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\\u$2")}); | |
btn.value="还原"; | |
mode="huan"; | |
}else{ | |
obj.value=unescape(obj.value.replace(/\\u/g,'%u').replace(/;/g,'')); | |
btn.value="转化"; | |
mode="zhuan"; |
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 checkBOM ($filename) { | |
global $auto; | |
$contents = file_get_contents($filename); | |
$charset[1] = substr($contents, 0, 1); | |
$charset[2] = substr($contents, 1, 1); |
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
String.prototype.repeat = function(count) { | |
// Go for it | |
var a = ""; | |
for (var i = count; i > 0; i--) { | |
a += this.valueOf(); | |
} | |
return a; | |
}; | |
//nice | |
String.prototype.repeat = function(count) { |
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
获取一组radio被选中项的值 | |
var item = $(‘input[@name=items][@checked]‘).val(); | |
获取select被选中项的文本 | |
var item = $(“select[@name=items] option[@selected]“).text(); | |
select下拉框的第二个元素为当前选中值 | |
$(‘#select_id’)[0].selectedIndex = 1; | |
radio单选组的第二个元素为当前选中值 | |
$(‘input[@name=items]‘).get(1).checked = true; | |
获取值: | |
文本框,文本区域:$(“#txt”).attr(“value”); |
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 put_ini_file ( $file , $array , $i = 0 ){ | |
$str = "" ; | |
foreach ( $array as $k => $v ){ | |
if ( is_array ( $v )){ | |
$str .= str_repeat ( " " , $i * 2 ). "[ $k ]" . PHP_EOL ; | |
$str .= put_ini_file ( "" , $v , $i + 1 ); | |
}else | |
$str .= str_repeat ( " " , $i * 2 ). " $k = $v " . PHP_EOL ; | |
} | |
if( $file ) |
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
/* | |
* @author duansong | |
* @email [email protected] | |
* @date 2014-1-14 | |
* @descrition 基于jquery的表单验证组件,支持ajax验证 | |
*/ | |
(function($,window){ | |
//配置文件 | |
var settings = { | |
//验证规则 |
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
/* | |
Enlarge for jQuery v1.1 | |
2013 | |
http://keleyi.com/ | |
*/ | |
(function ($) { | |
// 默认参数 | |
var defaults = | |
{ |
NewerOlder