August, 2011Archive for

Using CURL follow redirects to get final url

This example code shows you how to use curl to follow redirects and get final url. [code] <?php function get_final_url( $url, $timeout = 5 ) { $url = str_replace( "&amp;", "&", urldecode(trim($url)) ); $cookie = tempnam ("/tmp", "CURLCOOKIE"); $ch = curl_init(); curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" ); curl_setopt( $ch, ...

ExtJS4学习笔记 PHP代码

笔者在ExtJS4学习笔记原文中使用的服务器端代码是ASP的,我把它转成了PHP的。方便PHP的爱好者使用。代码如下: [code] <? //header('Cache-Control: no-cache, must-revalidate'); //header('Content-type: application/json'); //返回JSON数据,自定义一些测试数据。。 //这里的参数与EXT3.x相同,区别在于排序字段和排序方式使用了新的属性。 //由于这里是测试数据,接收的参数只用到了start,limit。sorts和dir在实际操作过程中,将之加入SQL的ORDER BY里即可。 $start = empty($_REQUEST["start"])?'':$_REQUEST["start"]; $limit = empty($_REQUEST["limit"])?'':$_REQUEST["limit"]; if ( $start == &qu...

Extjs- Ext.extend函数的使用

Ext.extend在Extjs 中扮演着重大角色,是Extjs中几个重要函数之一。要想深入了解EXTJS,这个函数非掌握不可,网上有很多关于这个函数的源码分析和介绍方面的文章,这里我只总结关于这个函数的使用的下几种情况,不详细分析这个函数的源码。 Example one: [code] function Base(config) { this.name=config.name; this.age=config.age; this.sex=config.sex; } function base(config) { this.identity=config.identity; this.msg=config.msg; this.phone=config.phone; base.superclass.constructor.call(this,config); } Ext.extend(base,Base,{ showMsg:function(){ window.alert(this.name+' '+...

Linux下禁用、启用SeLinux

一些Linux默认都是启用SeLinux的,在安装操作系统的时候我们可以选择开启或者关闭SeLinux,但是在安装完系统之后又如何开启与关闭呢? 在/etc/sysconf下有一个SeLinux文件,使用vi打开,更改其中的SELINUX项的值就可以了。 SELINUX=disable 禁用SeLinux SELINUX=enforcing 使用SeLinux 关闭SELinux 1. 无须重起而暂时关闭SELinux 以root用户运行以下命令 [code]# setenforce 0[/code] 这条命令的作用是把SELinux暂时设定成Permissive模式(关于Permissive Mode在以下会有介绍) 如果要恢复运行SELinux则可以运行 [code]# setenforce 1[/code] 这条命令会把SELinux设定成Enforcing模式 2. 把SELinux永久设定为Permissive模式 这里需要讲一下Permissive和Enforcing模式的区别。 SELinux有...