
php
文章平均质量分 55
marxw520
这个作者很懒,什么都没留下…
展开
-
[php基础]php环境变量
php有哪些环境变量?写出所有短变量与相应的长变量 注意:长变量在5.3后的版本被[deprecated] ====================淡定的分割线============================= $GLOBALS包含一个引用指向每个当前脚本的全局范围内有效的变量。该数组的键名为全局变量的名称。从 PHP 3 开始存在 $GLOBALS 数组。 $_...原创 2011-08-16 23:03:58 · 105 阅读 · 0 评论 -
CodeIgniter框架全面去除URL中的index.php
CodeIgniter框架的所有入口都是index.php, 比如http://localhost/index.php/controller/action/parameters 那么如何省略掉URL 上的 index.php, 让URL更简化:http://localhost/controller/action/parameters 有以下两大步: 1. 通过.htacc...2012-11-25 20:35:08 · 446 阅读 · 0 评论 -
[BASE] file_get_contents通过代理获取网络地址内容
$opt = array( 'http'=>array( 'method'=>'GET', 'header'=>"Content-Type:text/html;charset=utf-8" 'proxy'=>"http://192.168.1.1:8080", 't...原创 2013-04-26 22:12:05 · 272 阅读 · 0 评论 -
graphviz + php 画图
header("Content-type:image/png;");$content = "digraph call_graph{N1[shape=polygon,sides=6,label=\"A\",width=1, fontsize=15,style=filled,fillcolor=red]; N2[shape=polygon,sides=5,label=\"b\" ,width...原创 2013-04-21 21:20:09 · 176 阅读 · 0 评论 -
往事重提:php弱类型之比较
php是弱类型语言, 比如 变量$v的值为: 0 , false , null , '' ,"" ,未定义if(!$v) echo "true";都会输出true, 所以这些条件都为假, 这在其他一些语言中是不能容忍的。 于是我们在日常开发中也慢慢的习惯了这种弱类型。 以至于我们在判断字符串相等时,也会直接忽略了0的存在直接比较, 比如:$v = array(0=...原创 2013-04-21 19:59:52 · 149 阅读 · 0 评论 -
openSuse系统安装amp纪要
*inux系列系统,都有一个工具安装命令,比如:centos 的 yum, ubuntu下的apt , openSuse下的zypper, 如果系统联网了,即可直接使用这些工具安装,比较方便安装各种依赖包。如果不能联网且没有局域网的资源服务器的话, 就只能郁闷的一个个下载安装及依赖包去安装了。 以下记录openSuse下安装apache, mysql ,php 的步骤:1)安装配...原创 2013-04-21 19:39:41 · 183 阅读 · 0 评论 -
json_decode 整形溢出问题
最近调用一些网站的接口, 返回数据都是JSON格式, 用json_decode 时, 一些长整数变成了负数。 特此mark一下, 上次写得很长结果浏览器死了, 没发表成功, 晕。 这个iteye 是不是有问题, 点博客标题分类选择时,经常性白屏, 要刷新好几次才行。 长整形溢出的问题, 是因为这个PHP版本没有针对json_decode 作一些边界处理。 高版本已经处理了。...原创 2012-03-23 13:52:34 · 240 阅读 · 0 评论 -
递归显示当前目录树,可自定义结点标记
//静态层级数static $i = 0;//递归目录function showfile($dir){ global $i; $d = dir($dir); //echo "Handle: " . $d->handle . "\n"; //echo "Path: " . $d->path . "\n"; $i++; $space = printS...原创 2012-03-13 13:58:42 · 147 阅读 · 0 评论 -
根据用户IP调度不同节点之哈希散列方式
php一致性hash类下载地址:http://code.google.com/p/flexihash/ <?require_once 'flexihash.php'; $hostArr = array( 'img1.marx.com', 'img2.marx.com', 'img3.marx.com', 'img4.marx.com', 'img5....原创 2011-08-21 00:46:55 · 147 阅读 · 0 评论 -
字符串分隔数组及排序
<?php$str = 'Apple Strawberry Grape';$newstr = strtolower($str);$arr = explode(' ',$newstr);sort($arr);print_r($arr);输出结果:Array( [0] => apple [1] => grape [2] =...2011-08-16 23:50:33 · 255 阅读 · 0 评论 -
include() 与 require() 举例区别
1.报错include引入文件时,如果遇到错误,会报出Warning,并继续执行后面的代码;require引入文件时,如果遇到错误,会报出Error,并停止运行后面的代码。举例说明,创建两个名为 test-include.php 和 test-require.php 的PHP文件,注意相同的目录中,不要存在一个名字是test-nothing.php的文件。test-include.php...原创 2011-08-16 23:18:16 · 138 阅读 · 0 评论 -
ZF2共用分页模板显示ajax分页列表
通用的分页模板视图/view/application/page/control.phtml: <!--See http://developer.yahoo.com/ypatterns/pattern.php?pattern=searchpagination--><?php $url = '/application/pagination-test/test-...2012-09-29 17:33:10 · 138 阅读 · 0 评论