常用less变量定义
摘要:@bgfff:#fff;.bg(@color){background:@color;}.color(@color){color:@color;}.bgf{background:#fff;}.col333{color:#333}.cof{color:#fff}.col666{color:#666}.c
阅读全文
posted @
2017-06-28 15:56
vsmart
阅读(1236)
推荐(0)
PHP生成验证码2
摘要:getCode(4,60,20);function getCode($num,$w,$h) { $code = ""; for ($i = 0; $i < $num; $i++) { $code .= rand(0, 9); } //4位验证码也可以用rand(1000,9999)直接生成 //将生
阅读全文
posted @
2017-06-26 09:23
vsmart
阅读(121)
推荐(0)
extract高级用法 编写简历MVC模式
摘要:<?php class Control { //保存分配变量的对像属性 private $arr; /** * 分配置变量至视图 * @param [String] $name [变量名] * @param [type] $value [变量值] */ function assign ($name,
阅读全文
posted @
2017-06-23 15:28
vsmart
阅读(120)
推荐(0)
js获取文档高度
摘要:js获取文档高度 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.body.offsetWidth (包括边线的宽)网页可见区域高: document.body.offset
阅读全文
posted @
2017-06-21 14:05
vsmart
阅读(221)
推荐(0)
避免PHP分页中的分页出现非整数的简化代码
摘要:未简化的代码: if (isset($_GET['page'])) { $_page = $_GET['page']; if (empty($_page) || $_page < 0 || !is_numeric($_page)) { $_page = 1; } else { $_page = in
阅读全文
posted @
2017-06-20 04:53
vsmart
阅读(153)
推荐(0)
PHP restful 接口
摘要:首先我们来认识下RESTful Restful是一种设计风格而不是标准,比如一个接口原本是这样的: http://www.test.com/user/view/id/1 表示获取id为1的用户信息,如果使用Restful风格,可以变成这样: http://www.test.com/user/1 可以
阅读全文
posted @
2017-06-19 16:35
vsmart
阅读(281)
推荐(0)
PHP 连接数据库
摘要:header('Content-Type:text/html;charset=utf-8');$conn=mysql_connect("localhost","root","") or die ("连接失败:".mysql_error()); mysql_select_db("dbname",$co
阅读全文
posted @
2017-06-19 15:39
vsmart
阅读(121)
推荐(0)
PHP图片上传
摘要:<?phpheader('Content-Type:text/html;charset=utf-8'); if (is_uploaded_file($_FILES['upfile']['tmp_name'])) { $upfile = $_FILES['upfile']; $name = $upfi
阅读全文
posted @
2017-06-19 15:29
vsmart
阅读(164)
推荐(0)
cookie记录用户最后登录时间
摘要:<?php//ob_start();header('Content-Type:text/html;charset=utf-8');date_default_timezone_set("Asia/Shanghai"); if (!empty($_COOKIE["lastVisit"])) { echo
阅读全文
posted @
2017-06-19 11:26
vsmart
阅读(246)
推荐(0)
解决 各浏览器不支持display:flex的最简单办法
摘要:通常我们想让一行元素平均分配宽度,而且还是可以扩展自适应的;不管元素个数多少; 那么我们通常不考虑IE9以下及其它个别浏览器的时候 父级用 display:flex; 子级用 flex: 1; 但有时产品 要求 兼容 各浏览器 及IE8/9;我们不得不想尽各种办法, 包括JS/JS插件等 但大家都忽
阅读全文
posted @
2017-06-13 14:41
vsmart
阅读(11198)
推荐(0)
PHP 生成验证码
摘要:/** * _code()是验证码函数 * @access public * @param int $_width 表示验证码的长度 * @param int $_height 表示验证码的高度 * @param int $_rnd_code 表示验证码的位数 * @param bool $_fla
阅读全文
posted @
2017-06-13 03:40
vsmart
阅读(180)
推荐(0)
php文件上传
摘要:<?php $file = $_FILES['file'];//得到传输的数据//var_dump($file);exit();//得到文件名称$name = $file['name'];$type = strtolower(substr($name,strrpos($name,'.')+1));
阅读全文
posted @
2017-06-02 16:12
vsmart
阅读(141)
推荐(0)
H5图片异步拖拽上传
摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> #div1{width: 200px; height: 200px; background: red; margi
阅读全文
posted @
2017-06-02 15:33
vsmart
阅读(197)
推荐(0)