This file contains hidden or 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 xml_to_array($xml) | |
{ | |
preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $xml, $match); | |
$result = array(); | |
foreach ($match[1] as $x => $y) | |
{ | |
$result[$y] = $match[2][$x]; | |
} |
This file contains hidden or 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 | |
/** | |
* 计算两个日期相隔时间:年、月、日、时、分、秒 总计天数 | |
* @author TekinTian <tekintian@gmail.com> | |
* @param string $start_time 开始时间 必须 [格式如:2011-11-5 10:01:01] | |
* @param string $end_time 结束时间 选填,不提供默认未当前时间 [格式如:2012-12-01 10:01:01] | |
* @return array Array ( [y] => 年 [m] => 月 [d] => 日 [h] => 时 [i] => 分 [s] => 秒 [a] => 合计天数 ) | |
*/ | |
function get_date_diff($start_time,$end_time=''){ |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="Author" content="Tekin"> | |
<meta name="Keywords" content="防止刷新短信验证码获取, 无视刷新或者关闭浏览器! jquery cookie"> | |
<meta name="Description" content="防止刷新短信验证码获取, 无视刷新或者关闭浏览器! jquery cookie"> | |
<title>防止刷新短信验证码获取, 无视刷新或者关闭浏览器! jquery cookie </title> | |
<script src="http://cdn.bootcss.com/jquery/3.1.0/jquery.js"></script> | |
<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>China Map Svg</title> | |
<link rel="stylesheet" href=""> | |
</head> |
This file contains hidden or 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
package ws.yunnan; | |
import java.io.*; | |
import java.net.*; | |
public class QueryHelper { | |
public static String myip=null; | |
public static void main(String[] args) { |
This file contains hidden or 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
// 原生js Ajax请求函数 | |
// javascript调用iP查询接口示例: | |
function ajax(params){ | |
params = params||{}; | |
if (!params.url) { | |
throw new Error('Necessary parameters are missing.'); //必要参数未填 | |
} | |
var random = +new Date; | |
var hander = null; | |
var options = { |
This file contains hidden or 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:text/html; charset=utf-8'); | |
$str2 = $str = trim($_GET['str']); | |
//方法一: | |
echo mb_substr($str2, 0,1, 'UTF-8').'***'.mb_substr($str2, -1,1, 'UTF-8'); | |
echo "<br/>"; | |
//方法二: | |
$str = replace_utf8_string($str); |
This file contains hidden or 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 gettime($time){ | |
if ($time < 0) { | |
return '已结束'; | |
} else { | |
if ($time < 60) { | |
return $time . '秒'; | |
} else { |
This file contains hidden or 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 | |
/** | |
* 数据XML编码 | |
* @param mixed $data 数据 | |
* @param string $item 数字索引时的节点名称 | |
* @param string $id 数字索引key转换为的属性名 | |
* @return string | |
*/ | |
function data_to_xml($data, $item = 'item', $id = 'id') { |
NewerOlder