分类: 全部分类

127 篇文章

PHP在实现统计数据时,使用到的时间段
function total($type) { switch ($type) { case 3: { // 本月 $start = mktime(0, 0, 0, date('m'), 1, date('Y')); $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')); }; bre…
PHP取整的三个方法
floor()  (舍去小数部分,只取整数) ceil()  (进一取整,只要有小数部分,直接加一) round()  (四舍五入取整)
PHP curl后json_decode无法将json转换成数组
curl返回的数据中带有bom格式,需要转换; 有些返回数据直接: print_r(json_decode($data,true)); 就可以转换。   $url = "http://localhost/web_services.php"; $post_data = array ("username" => "bob","key" …
PHP 发送POST请求
/** * 发送post请求 * @param string $url 请求地址 * @param array $post_data post键值对数据 * @return string */ function send_post($url, $post_data) { $postdata = http_build_query($post_data…
Mysql添加外键
为已经添加好的数据表添加外键: 语法:alter table 表名 add constraint FK_ID foreign key(你的外键字段名) REFERENCES 外表表名(对应的表的主键字段名); 例: alter table tb_active add constraint FK_ID foreign key(user_id) REF…
老版phpstudy默认不支持64位php的解决方法
备忘一下: windows上用phpstudy比较简便,但是其默认的php所有版本都是32位的,有坑,比如int最大值。 所以从php官网 点击打开链接http://windows.php.net/download#php-7.0-nts-VC14-x64 , 下载一个64位的php7丢到phpstudy的php目录下面去(和其他版本一起的那个目录…
径向渐变(圆形)示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> 菜鸟教程(runoob.com) </title> <style> #grad1 { height: 150px; width: 200px; …