Archive for 四月, 2011

Linux下自行颁发SSL证书

  1. openssl genrsa -des3 -out test.com.key 1024
  2. openssl req -new -key test.com.key -out test.com.csr
  3. openssl rsa -in test.com.key -out test.com_nopass.key
  4. openssl x509 -req -days 365 -in test.com.csr -signkey test.com.key -out test.com.crt

Nginx的配置:

  1. server {
  2.    server_name www.test.com;
  3.    listen  443;
  4.    index index.html index.htm index.php;
  5.    root  /data/wwwroot/www.test.com;
  6.    ssl on;
  7.    ssl_certificate test.com.crt;
  8.    ssl_certificate_key test.com_nopass.key;
  9.    ......
  10. }

2 Comments

php的strtotime在处理am/pm时的一个BUG

今天在处理一个采集数据时发现采集到的时间是空的,到源网站看了一下,发现是有时间的。联想到之前一个am/pm的问题,然后就有了如下测试。
测试代码:

  1. $date = date('Y-m-d');
  2. $array = array('00:00am','00:00pm','00:01am','00:01pm', '01:01am','01:01pm','12:00am','12:00pm','12:01am','12:01pm');
  3. foreach ($array as $time) {
  4.     echo $date . ' ' . $time.'<br />';
  5.     echo strtotime($date . ' ' . $time).'<br />';
  6.     echo date('Y-m-d H:i:s', strtotime($date . ' ' . $time)).'<br /><hr />';
  7. }

大家可以先自己想想预期的答案是什么,再往下看:
Read the rest of this entry »

,

No Comments