随笔分类 -  6 PHP和MySQL学习

摘要:用法: CREATE TABLE test(id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,username VARCHAR(15) NOT NULL)AUTO_INCREMENT = 100; 在数据库应用,我们经常要用到唯一编号,以标识记录。在MySQL中可通过数据列的AUTO_INCREMENT属性来自动生成。MySQL支持多种数据表,... 阅读全文
posted @ 2009-07-31 15:33 尚远 阅读(346) 评论(0) 推荐(0)
摘要:待用 阅读全文
posted @ 2009-07-30 16:03 尚远 阅读(228) 评论(0) 推荐(0)
摘要:原文作者 刀客羽朋 ,这里重新整理,出处:http://www.cnblogs.com/tograce/category/161526.html① 接口(interface)是抽象方法和静态常量定义的集合;② 接口是一种特殊的抽象类,这种抽象类只包含抽象方法和静态常量;③ 接口中没有其它类型的内容。4.1 接口的定义和相关规范接口是这样定义的:[代码]一个简单的... 阅读全文
posted @ 2009-07-30 15:49 尚远 阅读(364) 评论(0) 推荐(1)
摘要:原文:http://www.ibm.com/developerworks/cn/opensource/os-php-regex2/在上回,接触了常见 regex 操作符,这里将介绍一些特殊 regex 操作符:1、括号 () 的功能;2、子模式限定符 ?: :它的功能是禁用捕捉;3、regex 末尾的 i 修饰语 :模式内的所有匹配都不区分大小写; regex ((?i)edu)  :它只表示子模... 阅读全文
posted @ 2009-07-19 11:12 尚远 阅读(303) 评论(0) 推荐(0)
摘要:原文作者 刀客羽朋 ,这里重新整理,出处:http://www.cnblogs.com/tograce/category/161526.html这一部分主要将学习如下几个内容:_______________________________static 变量、方法final类、final方法和常量abstract类和abstract方法设计模式之模版模式_______________________... 阅读全文
posted @ 2009-07-14 08:05 尚远 阅读(412) 评论(0) 推荐(1)
摘要:PHP 将提供两个 regex 编程接口,一个用于可移植操作系统接口(Portable Operating System Interface,POSIX),另一个接口用于 Perl Compatible Regular Expressions (PCRE)。基本上,推荐使用第二个接口,因为 PCRE 比 POSIX 实现更加强大,可以提供能在 Perl 中找到的所有操作符。在这里,主要介绍 PCR... 阅读全文
posted @ 2009-07-13 13:01 尚远 阅读(625) 评论(0) 推荐(0)
摘要:原文作者 刀客羽朋 ,这里重新整理,出处:http://www.cnblogs.com/tograce/category/161526.html 类的继承 类的继承是这样定义的: 一个关于继承的简单实例: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.... 阅读全文
posted @ 2009-01-06 13:29 尚远 阅读(480) 评论(0) 推荐(0)
摘要:原文作者 刀客羽朋 ,这里重新整理,出处:http://www.cnblogs.com/tograce/category/161526.html 类和对象 类是对一类事物描述,是抽象的、概念上的定义; 对象是实际存在的该类事物的每个个体,因而也称实例(instance) 创建对象的过程称为 创建对象 也称为实例化。 php中的类是这样定义的: Code highlighting pro... 阅读全文
posted @ 2009-01-02 22:20 尚远 阅读(593) 评论(0) 推荐(0)
摘要:foreach()有两种用法: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->1: foreach(array_name as $value) { statement; } 这里的array_name是你要... 阅读全文
posted @ 2008-12-09 14:10 尚远 阅读(10179) 评论(0) 推荐(1)
摘要:连接 Code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->query($query); $num_results = $result->num_rows; echo 'Number of books found: '.$num... 阅读全文
posted @ 2008-12-04 16:16 尚远 阅读(276) 评论(0) 推荐(0)
摘要:摘自 虾米的游乐场 的博 http://hi.baidu.com/usemm/blog/item/2c19703139b0f61feac4afa2.html 第一章 如何进行安装配置 PHP世界中比较流行的模板处理工具有PHPLIB Template和FastTemplate两种。据笔者看有关资料介绍,PHPLIB Template的技术易用性和速度较为理想,所以俺就学习使用了PHPLIB... 阅读全文
posted @ 2008-11-28 15:39 尚远 阅读(5724) 评论(0) 推荐(2)
摘要:(摘自:http://www.phpe.net) 作者:David Orrd 来源:PHPBuilder.com 如果你正想知道什么是模板,首先去看一下Sascha Schumann写的精彩文章《模板-为什么和如何在PHP3中使用它们(Templates - why and how to use them in PHP3)》的前几段。 一般来说,模板可以让你完全地把你的PHP代码从HTM... 阅读全文
posted @ 2008-11-26 17:00 尚远 阅读(321) 评论(0) 推荐(0)
摘要:创建自定义错误处理函数 Error:[$errno] $errstr"; } //通过 Set Error Handler 来触发 错误处理函数 set_error_handler("myError"); echo ($test); //将输出 Error:[8] Undefined variable: test ?> 触发错误 阅读全文
posted @ 2008-11-25 16:02 尚远 阅读(183) 评论(0) 推荐(0)
摘要:■ PHP 过滤器函数 在PHP中,用下面的滤器函数来过滤变量: filter_var() - 通过一个指定的过滤器来过滤单一的变量 filter_var_array() - 通过相同的或不同的过滤器来过滤多个变量 filter_input - 获取一个输入变量,并对它进行过滤 filter_input_array - 获取多个输入变量,并通过相同的或不同的过滤器对它们进行过滤 filt... 阅读全文
posted @ 2008-11-21 16:46 尚远 阅读(399) 评论(0) 推荐(0)
摘要:创建一个文件上传表单 upload_file.php Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> Filename: 标签的 enctype 属性规定了在提交表单时要使用哪种内容类型。在表单需要二进制数据时... 阅读全文
posted @ 2008-11-10 16:51 尚远 阅读(277) 评论(0) 推荐(0)
摘要:fopen() □ 浯法: int fopen(string filename, string mode); □ 说明: 打开文件 fopen()打开模式 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> * 'r' 开文件方式为只读... 阅读全文
posted @ 2008-11-10 16:13 尚远 阅读(195) 评论(0) 推荐(0)
摘要:The require() function is identical to include(), except that it handles errors differently. The include() function generates a warning (but the script will continue execution) while the require() f... 阅读全文
posted @ 2008-11-10 16:00 尚远 阅读(209) 评论(0) 推荐(0)
摘要:Date() □ 浯法: string date(string format, int [timestamp]); [timestamp]为选项参数, //将输出2008.11.10 字符串格式化的选项如下: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighl... 阅读全文
posted @ 2008-11-10 15:34 尚远 阅读(180) 评论(0) 推荐(0)
摘要:我们先建一个名为form_php.html的文件: Code Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> Your name: Your age: 然后建一个welcom.php文件: welcom.php Code ... 阅读全文
posted @ 2008-11-06 16:27 尚远 阅读(261) 评论(0) 推荐(0)
摘要:PHP Arrays □ Numeric Arrays 可以用下列两种方法定义: $names=array("Mike","Marry","Tom"); 或: $names[0]="Mike"; $names[1]="Marry"; $names[2]="Tom"; □ Associative Arrays 也有两种方法定义: $ages=array("Mike"=>20,"Marry"=>... 阅读全文
posted @ 2008-11-05 14:11 尚远 阅读(671) 评论(0) 推荐(0)