诚然博客

  • 首页
  • HTML
  • Jquery
  • PHP
  • ThinkPHP
  • Linux
  • 琐事
Jquery

jquery ajax异步上传表单插件 (文件+表单数据)--保存着

前端代码一看就懂的 官方地址http://jquery.malsup.com/form/ 点我下载jquery.form beforeSerialize: function($form, options) {     // return false 阻止表单提交 } beforeSubmit: function(arr, $form, options) {  &nbs…

2015年6月18日 0条评论 1185点热度 0人点赞 诚然 阅读全文
PHP

php 优化var_dump 最好的输出函数 对浏览器友好 取自thinkphp

比php自带的var_dump和print更直观,容易看懂 function dump($var, $echo=true, $label=null, $strict=true) { $label = ($label === null) ? '' : rtrim($label) . ' '; if (!$strict) { if (ini_get('html_errors')) { $output = print_r($var, true); $output = "" . $label . htmlspecialch…

2015年6月16日 0条评论 1120点热度 0人点赞 诚然 阅读全文
PHP

php 手机号验证 isMobile thinkphp 3.2 发邮件函数

/** * 验证手机号是否正确 * @param INT $mobile */ function isMobile($mobile) { if (!is_numeric($mobile)) { return false; } return preg_match('#^13[\d]{9}$|^14[5,7]{1}\d{8}$|^15[^4]{1}\d{8}$|^17[0,6,7,8]{1}\d{8}$|^18[\d]{9}$#', $mobile) ? true : false; } /** * Thinkphp 3…

2015年6月3日 0条评论 1175点热度 0人点赞 诚然 阅读全文
PHP

thinkphp 通过ip获取真实地址 取巧方法

function getipinfo(){ header("Content-Type:text/html; charset=utf-8"); $url = 'http://1111.ip138.com/ic.asp'; //这儿填页面地址 $info=httpGet($url); $p = "%(.*?)%si"; preg_match_all($p, $info, $arr); $info=$arr[1]; $str1 = explode("[",iconv('GB2312', 'UTF-8',$info[0])…

2015年6月3日 0条评论 1013点热度 0人点赞 诚然 阅读全文
PHP

Thinkphp 3.2 get_result get_info list_to_tree int_to_string

thinkphp 获取数据集 和 获取单挑数据 list_to_tree 在导航等用的多 int_to_string将数字 转换为字符串 在一些 什么 男女 状态等地方用的多 方便 /* * 获取数据集 * */ function get_result($Model,$map=array(),$field='',$order='',$limit=0,$group='',$having=''){ if(is_string($Model)){ $Model = M($Model); } if($limit==0){ $…

2015年6月3日 0条评论 1112点热度 0人点赞 诚然 阅读全文
ThinkPHP

基于公司thinkphp 基础上的一些经验(视图模型 事务)

1、添加地址栏地址 param($add=array(),$del='')   $add会自动添加当前地址栏已有的条件 然后再添加自己加入的key val Del会删除填写的条件!! 以前把地址栏所有条件写在上面,蠢死咯,用法 ('要添加的键值对'),'要删除的key'))?> ; 2、截取字符串 自动添加标点 Msubstr($str,0,10) 0为开始 10为结束点  意思即为10个字  有超出省略 加省略号 3、数据库 积分…

2015年3月25日 0条评论 1328点热度 0人点赞 诚然 阅读全文
PHP

php 获取汉字首字母

function chineseFirst($str) { $str= iconv("UTF-8","gb2312", $str); //如果程序是gbk的,此行就要注释掉 //判断字符串是否全都是中文 if (preg_match("/^[\x7f-\xff]/", $str)) { $fchar=ord($str{0}); if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str{0}); $a = $str; $val=ord…

2015年3月23日 0条评论 971点热度 0人点赞 诚然 阅读全文
Nodejs

弄nodejs的一些记录

安装 淘宝镜像 npm install express --registry=https://registry.npm.taobao.org var app = require('http').createServer(handler), io = require('socket.io').listen(app), fs = require('fs')app.listen(808…

2015年3月19日 0条评论 1597点热度 0人点赞 诚然 阅读全文
ThinkPHP

Thinkphp setInc setDec 快速加减数字字段

$User = M("User"); // 实例化User对象 $User->where('id=5')->setInc('score',3); // 用户的积分加3 $User->where('id=5')->setInc('score'); // 用户的积分加1 $User->where('id=5')-…

2015年3月19日 0条评论 1857点热度 0人点赞 诚然 阅读全文
Nodejs

nodejs的安装记录

1、软件环境: Centos7、VMware 10.0、NodeJS v0.10.24  2、首先确认有nodejs编译及依赖相关软件,如果没有可通过运行以下命令安装。  [root@localhost sharing]# yum -y install gcc gcc-c++ openssl-devel 3、下载NodeJS源码包并解压。  [root@localhost sharing]#&nb…

2014年9月19日 0条评论 1819点热度 0人点赞 诚然 阅读全文
1234

COPYRIGHT © 2012-现在 诚然博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

鄂ICP备2022012104号-2