windows正确配置php_curl扩展库的方法

windows 下Apache + PHP + Mysql正确配置php_curl扩展库的方法:

1,打开你php所在目录,找到php.ini文件并打开把 ;extension=php_curl.dll, 去掉前面的注释.

extension=php_curl.dll

2,接下来我们还得把php目录下的 libeay32.dll和ssleay32.dll复制到windows\system32目录下面.
3,重新启动你的Apache服务器。

一切搞定之后 curl_init()函数就可以正常使用了…

61c7f650jw1e314rwtg7dj
如果有一天,让你心动的再也感动不了你,让你愤怒的再也激怒不了你,让你悲伤的再也不能让你流泪,你便知道这时光,这生活给了你什么,你为了成长,付出了什么。

6910f821jw1e30jfv6d8aj
久不联系的朋友,我不知道要用什么理由关心你的生活,我不知道要用什么借口让你能听一听我诉的苦水,我怀念当初的日子,即使我知道生活总是往前。或许我很久没有联系你了,不要觉得我无情,不要觉得我喜新,不要觉得我厌旧,我只是怕一开口,就变成了令人心酸的客套#致我曾经的好朋友「via Yp杨英鹏」

php正则验证手机号

<!--?php 
$tel = "13696005585";
$ab = preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$tel);
 
/*
说明:
^表示这符开始(元字符)
$表示字符结尾(元字符)
13为普通字符
[0-9]表示一个0-9的数字
{9} 表示匹配9次
后面的号码,如果是13开头的,中间有9个数字,并结尾,则符合条件
*/
 
if($ab)
{
  echo "手机号对了";
 
}
  else
  echo "不是手机号";
?-->

JS:

var phoneStr=/^13[0-9]{1}[0-9]{8}$|15[025189]{1}[0-9]{8}$|18[0-9]{9}$/
                var phone=$('input[name=phone]').val();
                if($('input[name=phone]').val()!=''){
                    if(!phoneStr.test(phone)){
                     art.dialog.alert('移动电话格式不正确');
                        return false;
                    }
                }

验证邮箱:
PHP:

 $em = preg_match("/^[0-9a-zA-Z]+@(([0-9a-zA-Z]+)[.])+[a-z]{2,4}$/i", $data['shyemail']);
            if (!$em) {
                $this->_return(null, '邮编格式不正确!', 0);
            }
            }

CSS3 Media Queries 让网页更好的支持移动设备

CSS3的Media Queries可以查询设备的屏幕尺寸颜色等信息,我们就可以根据不同的设备来写CSS,让网页在不同设备上有更好的用户体验。本站做了一些尝试,有兴趣的朋友可以缩放网页窗口看下效果。下面简单介绍一下基本用法:

    /* 基本语法 */
    @media screen and (min-width:1024px) and (max-width:1280px){
    body{padding:1em;}
    }

/* 常用类型 */
类型 解释
all 所有设备
braille 盲文
embossed 盲文打印
handheld 手持设备
print 文档打印或打印预览模式
projection 项目演示,比如幻灯
screen 彩色电脑屏幕
speech 演讲
tty 固定字母间距的网格的媒体,比如电传打字机
tv 电视

screen一般用的比较多,下面是我自己的尝试,列出常用的设备的尺寸,然后给页面分了几个尺寸的版本。

/* 常用设备 */
设备 屏幕尺寸
显示器 1280 x 800
ipad 1024 x 768
Android 800 x 480
iPhone 640 x 960

1280 > 1024 > 960 > 800 >768 > 640

    /* 根据上述尺寸简单的分了几个页面版本 */
    @media screen and (min-width:1280px){
    body{ 适合较大的台机显示器或更大 }
    }
 
    @media screen and (min-width: 800px) and (max-width: 1280px) {
    body{ 适合一般的台机显示器或笔记本 }
    }
 
    @media screen and (max-width: 800px) {
    body{ 适合一般的平板电脑或智能手机 }
    }

国际惯例:IE5.5/6/7是不支持media query的,所以我也把这种不支持利用了起来,尝试去区分IE和非IE浏览器的样式,不知道是否合理?!

    @media screen and (min-width: 0px) {
    body{ IE goodbye }
    }

我是通过屏幕尺寸来简单的区分页面样式,如果你想细分样式你可以参考一下内容。

    /*Google的iPhone横屏样式*/
    @media screen and (max-height:300px){
    body{ iPhone 横屏 }
    }
 
    /*android手机的多分辨率*/
    /* for 240 px width screen */
    @media only screen and (max-device-width:240px){
    body{ for Android }
    }
 
    /* for 360px width screen */
    @media only screen and (min-device-width:241px) and (max-device-width:360px){
    body{ for Android }
    }
 
    /* for 480 px width screen */
    @media only screen (min-device-width:361px)and (max-device-width:480px){
    body{ for Android }
    }
 
    /* device-aspect-ratio 特定屏幕长宽比例 */
 
    /* for 4:3 screen */
    @media only screen and (device-aspect-ratio:4/3){
    body{ }
    }
 
    /* for 16:9 and 16:10 screen */
    @media only screen and (device-aspect-ratio:16/9) and (device-aspect-ratio:16/10){
    body{ }
    }
 
    /* for 480px*800px width screen */
    @media only screen (device-aspect-ratio:5/3){
    body{ }
    }

http://mediaqueri.es/是一个国外的网站,上面有许多使用Media Queries的作品展示。

Create .install file schema drupal 7

First we need to implement hook_schema() to define the table to store our entities. Drupal schema is an associated array representing the structure of database tables. During module installation, Drupal will call this hook automatically to install necessary tables. During module uninstallation, Drupal will remove the database tables defined in this hook. If there are no other installation procedure, hook_install() or hook_uninstall() does not need to be implemented. If the module implements hook_schema(), the database tables will be created before this hook_install() is fired.

The structure of client entity can be very basic, otherwise we could just use node instead.

$schema['client'] = array(
  'description' => 'The base table for client',
  'fields' => array(
    'cid' => array(
      'description' => 'The primary identifier for the client.',
      'type' => 'serial',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
    'type' => array(
      'description' => 'The {client_type}.type of this client.',
      'type' => 'varchar',
      'length' => 32,
      'not null' => TRUE,
      'default' => '',
    ),
    'name' => array(
      'description' => 'The name of the client.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
    ),
  ),
  'primary key' => array('cid'),
  'indexes' => array(
    'type' => array('type'),
  ),
);

In this table, the type field indicates what type of client the entity is. If the entity only has one bundle, then we probably do not need this field. But since we would like to have many bundles with entity of client, we will need this field. This schema definition will create the following table shown in MySQL database:

mysql> DESC client;
+-------+------------------+------+-----+---------+----------------+
| FIELD | TYPE             | NULL | KEY | DEFAULT | Extra          |
+-------+------------------+------+-----+---------+----------------+
| cid   | INT(10) UNSIGNED | NO   | PRI | NULL    | AUTO_INCREMENT |
| TYPE  | VARCHAR(32)      | NO   | MUL |         |                |
| name  | VARCHAR(255)     | NO   |     |         |                |
+-------+------------------+------+-----+---------+----------------+

cid is the primary key and type is being indexed. Indexes are best used on columns that are frequently used in WHERE clauses, and in any kind of sorting, such as ORDER BY.

We also need a table to store different type of clients, or bundle definition table.

$schema['client_type'] = array(
  'description' => 'Stores information about all defined {client} types.',
  'fields' => array(
    'type' => array(
      'description' => 'The machine-readable name of this type.',
      'type' => 'varchar',
      'length' => 32,
      'not null' => TRUE,
    ),
    'name' => array(
      'description' => 'The human-readable name of this type.',
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
      'translatable' => TRUE,
    ),
    'description' => array(
      'description' => 'A brief description of this type.',
      'type' => 'text',
      'size' => 'medium',
      'not null' => TRUE,
      'translatable' => TRUE,
    ),
    'help' => array(
      'description' => 'Help information shown to the user when creating a {client} of this type.',
      'type' => 'text',
      'size' => 'medium',
      'not null' => TRUE,
      'translatable' => TRUE,
    ),
  ),
  'primary key' => array('type'),
);

The MySQL database table for the above schema is:

mysql> DESC client_type;
+-------------+--------------+------+-----+---------+-------+
| FIELD       | TYPE         | NULL | KEY | DEFAULT | Extra |
+-------------+--------------+------+-----+---------+-------+
| TYPE        | VARCHAR(32)  | NO   | PRI | NULL    |       |
| name        | VARCHAR(255) | NO   |     |         |       |
| description | mediumtext   | NO   |     | NULL    |       |
| help        | mediumtext   | NO   |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+

593ce481jw1e2ri8k915ej
每个人的初恋,大都十分纯情。跨过了初恋,爱情就生出了很多姿态。有人变得风流,见一个爱一个;有人冷漠,再不会拿出真心爱第二个人;不是每个人,都适合和你白头到老。有的人,是拿来成长的;有的人,是拿来一起生活的;有的人,是拿来一辈子怀念的。

7b38fb67jw1e2n044jtn7j
青春就是用来追忆的,当你怀揣着它时,它一文不值,只有将它耗尽后,再回过头看,一切才有了意义。爱过我们的人和伤害过我们的人,都是我们青春存在的意义。青春,最终只不过是年久失修的陈黄纸画,轻轻一碰,就碎飘于风中,化于无痕。—— 辛夷坞《致我们终将逝去的青春》

Drupal7 修改系统tabs上显示的文字

系统tabs上默认显示的文字如 “view” 但有时根据项目的要求我们得把它改过,例如我们要将内容类型为 “product”的就要改为’Overivew’,而内容类型为”article”的要改为”View Article”,别的内容类型还是为默认的”view”.就可以用到以下的代码:

function hello_menu_alter(&$items) {
    unset($items['node/%node/view']['title']);
    $items['node/%node/view']['title callback'] = 'hello_view_tab_title';
    $items['node/%node/view']['title arguments'] = array(1);
}
 
function hello_view_tab_title($node) {
    if ($node->type == 'article') {
        return t('View Article');
    }
    if ($node->type == 'product') {
        return t('Overivew');
    }
    return t('View');
}

把以上代码加入到你的自定义module中,并把 “hello”替换成你的module名称.就可以实现了…