(备忘)MySQL实用命令

一 连接MYSQL:

格式: mysql -h主机地址 -u用户名 -p用户密码

1、例1:连接到本机上的MYSQL

首先在打开DOS窗口,然后进入mysql安装目录下的bin目录下,例如: D:\mysql\bin,再键入命令mysql -uroot -p,回车后提示你输密码,如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,MYSQL的提示符是:mysql>

2、例2:连接到远程主机上的MYSQL

假设远程主机的IP为:10.0.0.1,用户名为root,密码为123。则键入以下命令:
mysql -h10.0.0.1 -uroot -p123
(注:u与root可以不用加空格,其它也一样)

3、退出MYSQL命令

exit (回车)

全文阅读 »

date函数格式化UNIX时间戳时差问题的解决方法

插入数据库里的时间格式是unix时间戳

当再用date函数格式化unix时间戳时发现是格林尼治的时间


$nowtime = time();
$mtime = date('Y-m-d H:i:s',$nowtime);

echo $mtime;

解决方法:

在使用date函数之前先设置默认时区


date_default_timezone_set('Etc/GMT-8');

OK..现在输出的就是东八区的时间了..

Zend Studio 常用快捷键

原文地址 http://www.zendstudio.net/component/ZendStudio-Shortcuts/

编辑功能

Ctrl + / 单行注释
Ctrl + Shift + / 块注释
Ctrl + U 选择的代码片段全部转换为大写
Ctrl + L 选择的代码片段全部转换为小写
Ctrl + D 复制光标所在行
Ctrl + E 删除光标所在行
Tab 增加代码缩进
Shift + Tab 减少缩进
Ctrl + Alt+ F 在文件中查找
Ctrl + BackSpace 删除光标前一个单词或一个符号
Ctrl + G 转到行
Alt + → 定位到光标的下一个位置
Alt + ← 定位到光标的上一个位置

环境切换

Esc 隐藏辅助窗口
Ctrl + W 切换自动换行
Ctrl + Tab 在各个编辑器标签页之间切换
Ctrl + F4 关闭当前标签页
Alt + F4 关闭ZDE

全文阅读 »

2008年CSS裸体日 俺博客自动脱光光 适用于各种PHP Blog

今年的CSS Naked Day与往年推后了四天(4月9日)..

有些朋友已经迫不及待要让自己的网站裸奔了..

俺太懒.写几行代码.让俺的博客到时自己脱光光吧..

俺用的wordpress 同样适用于其它php博客

只需要css引用语句处加上如下代码:

  1. <?php 
  2. $NakedDay = date('md',time());//获得当前时间.用date函数格式化unix时间戳.
  3. if($NakedDay != '0409')//判断当前日期.如果为0409就不执行
  4. {
  5. ?>
  6. <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />//俺博客的样式表..
  7. <?php 
  8. }
  9. ?>

setcookie函数的作用域问题

在不同目录下的文件.不能访问各自设置的cookie

查了一下手册.setcookie函数有一个path参数.可以设置本地cookie的作用域

解释如下:

The path on the server in which the cookie will be available on. If set to ‘/’, the cookie will be available within the entire domain . If set to ‘/foo/’, the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.

另一个参数domain
则是设置网络上cookie的作用域.

解释如下:

The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you’d set it to ‘.example.com’. The . is not required but makes it compatible with more browsers. Setting it to www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the » spec for details.

示例:

  1. $setcookday = 30;//设置cookie有效期
  2. setcookie('uname', '银子', time() + ($setcookday * 24 * 60 * 60),'/','qqdang.net'); //分别为cookie名称.cookie值.cookie有效时间.cookie本地作用域.cookie网络作用域

浏览最多的10篇日志

评论最多的10篇日志

随机显示的10篇日志