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有...

Sorting a two dimensional array in javascript

Sorting arrays in JavaScript is done via the method array.sort(). Passing in a function reference into array.sort() As touched on already, array.sort() accepts an optional parameter in the form of a function reference (lets call it sortfunction). The format of this function looks like this: [code] array.sort(sortfunction) function sortfunction(a, b){ //Compare "a" and "b" in some fashion, and return -1, 0, or 1 } [/code] When such a function is passed in...

PHP Array List of English Stop Words

Stop Words are words which do not contain important significance to be used in Search Queries. Usually these words are filtered out from search queries because they return vast amount of unnecessary information. A better definition is provided below: “Words that do not appear in the index in a particular database because they are either insignificant (i.e., articles, prepositions) or so common that the results would be higher than the system can handle (as in the case of IUCAT where terms suc...

9 Useful PHP Functions and Features You Need to Know

1. Functions with Arbitrary Number of Arguments You may already know that PHP allows you to define functions with optional arguments. But there is also a method for allowing completely arbitrary number of function arguments. First, here is an example with just optional arguments: [code] // function with 2 optional arguments function foo($arg1 = '', $arg2 = '') { echo "arg1: $arg1\n"; echo "arg2: $arg2\n"; } foo('hello','world'); /* prints: arg1: hello ...

Learn English 2011

Online shopping is the best thing since sliced bread! Online shopping is a new way to shop - so someone "invented/discovered/developed" this new way to shop. Many years ago people ate bread but the bread was not sliced, so they had to pull the bread apart using their hands. Then someone invented/discovered/developed a new way to make the bread easier to handle - they cut the loaf into slices of bread. That was a small invention - not the most important invention in the history of the world, bu...

20 Tools to Improve Your Website’s Usability

Usability testing is test conducted to collect feedback and information from your website’s visitors or regular readers that can be very useful for future website revamp, enhancement or other adjustments. Designers and developers may have created websites according to specifications, but ultimately it is the users who will decide its creditability (how far it is usable), the highlights of the site and what does it lack of. How to know whether a visitor likes your website? Usability ...

ThinkPHP示例之 字段映射

要使用模型的自动创建create方法的话,ThinkPHP的表单名称就是数据表的字段名称,如果担心这样不够安全,可以定义字段映射,来隐藏实际的数据表字段名称。 下面的例子就运用了字段映射定义。请注意看表单名称和字段的对应关系。 标题: 邮箱: 内容: 验证码: 输入对应的数字 示例源码 控制器IndexAction类 [code] <?php class IndexAction extends Action{ // 首页 public function index(){ $Form = D("Form"); $list = $Form->findAll(); $this->assign('list',$list); $this->display(); } // 处理表单数据 public funct...

ThinkPHP的html:list标签简要用法及注意事项

<html:list id="checkList" name="user" style="list" checkbox="true" action="true" datasource="list" show="id:编号|8%,title:标题:edit,content:内容,create_time|toDate='Y-m-d H#i#s':添加时间,status|getStatus:状态" actionlist="forbid|resume:禁用|恢复,edit:编辑" /> ThinkPHP的html标签库中的list标签功能强大,但没有文档.只好看源码了. 大概如下: datasource和show必须要, datasource是数据源名称, 也就是assign所指向的变量, show是最复杂的, 等会再讲 pk是主键名, 默认为id;style是css样式的class, 因为整个list标签会被编译成table, 比如这里为mylist, 那么样式表中的table.mylist样式就会用在这; checkbox是否显示复选框; action是否显示操作列 s...