
php
文章平均质量分 64
firesnow
这个作者很懒,什么都没留下…
展开
-
ubuntu php 开启rewrite 模块
错误信息[Sat Mar 09 23:06:30 2013] [alert] [client 127.0.0.1] /var/www/capitalog_ib/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server con原创 2013-05-20 10:52:02 · 1237 阅读 · 0 评论 -
php获取访问者ip
方法一:$_SERVER['HTTP_X_FORWARDED_FOR']来获取相应的地址/** * 获取访问者IP * */ public static function get_client_ip() { if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'),转载 2013-05-29 17:36:39 · 1193 阅读 · 0 评论 -
centos php 安装memcache模块
wget http://pecl.php.net/get/memcache-3.0.8.tgz //下载tar zxvf memcache-3.0.8.tgzcd memcache-3.0.8phpize如果显示phpize: command not found执行yum install php-devel php-pear httpd-devel继续执行phpiz原创 2014-01-15 19:45:37 · 1658 阅读 · 0 评论 -
生成php随机数
public static function randomkeys($length) { $key = ''; $pattern = '1234567890abcdefghijklmnopqrstuvwxyz'; for ($i = 0; $i < $length; $i++) { $key .= $pattern{mt_ra原创 2013-11-18 17:46:55 · 973 阅读 · 0 评论 -
php操作xml
1.读取function get_data_from_xml($res_data, $node) { $xml = simplexml_load_string($res_data); $result = $xml->xpath($node); while (list(, $node) = each($result)) { return $node;原创 2013-11-12 15:03:44 · 661 阅读 · 0 评论 -
php curl简单使用
post$ch = curl_init(); //创建对象curl_setopt($ch, CURLOPT_URL, $url); //请求的地址curl_setopt($ch, CURLOPT_POST, true); //请求类型为postcurl_setopt($ch, CURLOPT_PORT, 8080); //请求端口curl_setopt($ch, CURLOPT_T原创 2013-11-11 20:19:53 · 1440 阅读 · 0 评论 -
目前最符合规范的PHP版Email地址验证代码
private function __validEmail($email){ $isValid = true; $atIndex = strrpos ( $email, "@" ); if (is_bool ( $atIndex ) && ! $atIndex) { $isValid = false; }else{ $domain =转载 2013-05-29 17:35:23 · 769 阅读 · 0 评论 -
php正则验证各种格式
<?php/** * Description of RegularUtil * * @author 张策 */class RegularUtil { //数字 public static function number($str) { if (preg_match("/^\d*$/ ", $str)) { return TRU原创 2013-07-03 18:20:41 · 2678 阅读 · 0 评论 -
ubuntu下安装gearman及php,python扩展
1.安装依赖包sudo apt-get install libboost-all-devsudo apt-get install gperfsudo apt-get install libevent1-dev2.下载安装gearmanwget https://launchpad.net/gearmand/1.2/1.1.8/+download/gearmand-1.1.8.tar.原创 2013-07-13 22:28:55 · 2027 阅读 · 0 评论 -
ubuntu下手动安装php-amqp模块教程
用于ubuntu的默认源里面没有php5-amqp这个包,所以要用上amqp得考手动编译。首先安装必须的php编译工具sudo apt-get install php5-dev安装rabbitmq的库sudo apt-get install librabbitmq-dev如果你的Linux发行版没有现成的librabbitmq-dev包,那么可以通过下载源码编译安装转载 2013-05-22 22:30:36 · 2661 阅读 · 1 评论 -
ubuntu php安装curl扩展
首先输入apt-cache search curl | grep php查询curl的php支持名字可能会返回如下内容:php5-curl - CURL module for php5安装:sudo apt-get install php5-curl重启apachesudo /etc/init.d/apache2 restart转载 2013-05-20 11:05:49 · 3238 阅读 · 0 评论 -
ubuntu下安装apache php
最近重装了ubuntu系统,所以要重装apache php。再次记录下来方便以后查阅。1.安装apachesudo apt-get install apache2安装完成。 运行如下命令重启下:sudo /etc/init.d/apache2 restart在浏览器里输入http://localhost或者是http://127.0.0.1,如果看到了It work原创 2013-05-19 16:01:23 · 935 阅读 · 0 评论