随笔分类 -  PHP & MySql

上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
PHP & MySql
摘要:PHP中的__set & __get使用官方说明publicvoid__set(string$name,mixed$value)publicmixed__get(string$name)publicbool__isset(string$name)publicvoid__unset(string$name)在给未定义的变量赋值时,__set()会被调用。读取未定义的变量的值时,__get()会被调用。当对未定义的变量调用isset()或empty()时,__isset()会被调用。当对未定义的变量调用unset()时,__unset()会被调用。参数$name是指要操作的变量名称。__s 阅读全文
posted @ 2012-12-04 15:26 Athrun 阅读(331) 评论(0) 推荐(0)
摘要:PHP Exception官方文档:http://cn2.php.net/exceptionsDeom 1<?phpclass Conf { private $file; private $xml; private $lastmatch; function __construct( $file ) { $this->file = $file; if ( ! file_exists( $file ) ) { throw new Exception( "file '$file' does not exist" ); ... 阅读全文
posted @ 2012-12-04 14:40 Athrun 阅读(355) 评论(0) 推荐(0)
摘要:PHP SimpleXML 简介SimpleXML 函数允许您把 XML 转换为对象。通过普通的属性选择器或数组迭代器,可以处理这个对象,就像处理任何其他对象一样。其中的一些函数需要最新的 PHP 版本。SimpleXML 函数是 PHP 核心的组成部分。无需安装即可使用这些函数。函数描述PHP__construct()创建一个新的 SimpleXMLElement 对象。5addAttribute()给 SimpleXML 元素添加一个属性。5addChild()给 SimpleXML 元素添加一个子元素。5asXML()从 SimpleXML 元素获取 XML 字符串。5attribute 阅读全文
posted @ 2012-12-04 14:32 Athrun 阅读(210) 评论(0) 推荐(0)
摘要:From :http://bbs.csdn.net/topics/360002529php 5.3新增的闭包语法介绍function() use() {}Demo1function callback($callback) { $callback();}callback(function() { print "This is a anonymous function.<br />\n";});输出: This is a anonymous function.<br />\n这里是直接定义一个匿名函数进行传递, 在以往的版本中, 这是不可用的.现在, 这 阅读全文
posted @ 2012-12-04 13:57 Athrun 阅读(262) 评论(0) 推荐(0)
摘要:Converting to objectIf an object is converted to an object, it is not modified. If a value of any other type is converted to an object, a new instance of the stdClass built-in class is created. If the value was NULL, the new instance will be empty. Arrays convert to an object with properties named b 阅读全文
posted @ 2012-12-04 13:41 Athrun 阅读(216) 评论(0) 推荐(0)
摘要:From :http://my.oschina.net/liuhui1990/blog/38611基于PHP版本: 5.3.5PHP5.3 以后引入了延迟静态绑定:static(关键字)类似于self(关键字), 但它指向的是被调用的类(Document)而不是包含类(DomainObject),static和self的区别:<?phpclass DomainObject{ public static function createStatic(){ return new static(); } public static function cr... 阅读全文
posted @ 2012-11-30 00:18 Athrun 阅读(246) 评论(0) 推荐(0)
摘要:From :http://www.winet.cn/php/language.types.string.php变量解析当用双引号或者定界符指定字符串时,其中的变量会被解析。有两种语法,一种简 单的和一种复 杂的。简单语法最通用和方便,它提供了解析变量,数组值,或者对象属性的方法。复杂语法是 PHP 4 引进的,可以用花括号括起一个表达式。简单语法如果遇到美元符号($),解析器会尽可能多地取得后面的字符以组成一个合法的变量 名。如果想明示指定名字的结束,用花括号把变量名括起来。de<<?php$beer='Heineken';echo"$beer's 阅读全文
posted @ 2012-11-29 23:19 Athrun 阅读(722) 评论(0) 推荐(0)
摘要:动态属性问题给程序带来很多麻烦,以下是一位朋友的解决方法如下:From :http://bbs.php100.com/read-htm-tid-25526.html<?phpclass testClass { private $va; private $vb; private $vc; private $allVars; public function __construct(){ echo 'testClass __construct'.'</br>'; //$this->va = 1; $this->getAllVar... 阅读全文
posted @ 2012-11-29 23:04 Athrun 阅读(463) 评论(0) 推荐(0)
摘要:<?php/*产品类*/class Product{ public static $Count=0; public $Name=''; public function Show(){ print('<p>Show Method</p>'); } public static function Display(){ print('<p>Display Static Method</>'); }}$class = new ReflectionClass('Product');prin 阅读全文
posted @ 2012-11-29 21:52 Athrun 阅读(761) 评论(6) 推荐(0)
摘要:资料参考:http://dev.mysql.com/doc/refman/5.5/en/create-event.htmlBaidu mysql eventMySQL 定时器EVENT学习 阅读全文
posted @ 2012-11-17 23:07 Athrun 阅读(141) 评论(0) 推荐(0)
摘要:转:http://www.cnblogs.com/yidianfeng/archive/2011/02/24/1964148.htmlMySQL有两种常用的引擎类型:MyISAM和InnoDB。目前只有InnoDB引擎类型支持外键约束。InnoDB中外键约束定义的语法如下:[CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name, ...) REFERENCES tbl_name (index_col_name,...) [ON DELETE reference_option] [ON UPDATE reference_opt 阅读全文
posted @ 2012-09-10 13:02 Athrun 阅读(362) 评论(0) 推荐(0)
摘要:转:http://taobeibei.iteye.com/blog/685019MySQLdatediff(date1,date2):两个日期相减 date1 - date2,返回天数。selectdatediff('2008-08-08', '2008-08-01'); -- 7selectdatediff('2008-08-01', '2008-08-08'); -- -7参考:MySQL:日期函数、时间函数总结(MySQL 5.X)http://rubyqiu.php.blog.163.com/blog/static/861 阅读全文
posted @ 2012-09-10 11:12 Athrun 阅读(1341) 评论(1) 推荐(0)
摘要:http://www.wincold.com/archives/94.html国外有很多优秀的网店商城程序,而且是免费开源的,对做电子商务和外贸的朋友是很不错的选择。下面介绍的一些电子商务系统程序,有的是老牌的了,有的则是后起之秀,各有特色优点吧,关键是选择一款适合自己的。1.Magento (免费)Magento设计得非常灵活,具有模块化架构体系和丰富的功能。易于与第三方应用系统无缝集成。Magento在设计上,考虑相当全面,以模块化架构体系,让应用组合变得相当灵活,功能也相当丰富。Magento开源网店系统的特点主要分以下几大类: 网站管理 促销和工具、 国际化支持 、SEO搜索引擎优化 阅读全文
posted @ 2012-09-07 15:48 Athrun 阅读(1136) 评论(0) 推荐(0)
摘要:转自:http://dzh.mop.com/whbm/20111117/0/llzg8OI28297d4Fz.shtml1.使用mysqladmin修改mysql密码C:\>mysqladmin -udbuser -p password newpassEnter password: oldpass当然用此命令的前提是你把mysql加入了环境变量,如果没有加入环境变量的话那只能在命令行下cd到mysqladmin所在的目录下与此那个次命令了!-----------------------------------------2.重置root密码方法一:在my.ini的[mysqld]字段加入 阅读全文
posted @ 2012-04-25 11:48 Athrun 阅读(364) 评论(0) 推荐(0)
摘要:<?php/** Author: AthrunSoft* class.pdomysql.php 0.01 2012-4-15*/class pdomysql { public static $dbtype = 'mysql'; public static $dbhost = ''; public static $dbport = ''; public static $dbname = ''; public static $dbuser = ''; public static $dbpass = '&# 阅读全文
posted @ 2012-04-19 15:40 Athrun 阅读(581) 评论(0) 推荐(0)
摘要:轉自 : http://apps.hi.baidu.com/share/detail/50250843#content例 1654. Connecting to MySQL<?php$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);?>例 1655. Handling connection errors<?phptry {$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);foreach 阅读全文
posted @ 2012-04-18 09:02 Athrun 阅读(391) 评论(0) 推荐(0)
摘要:管方资料:http://dev.mysql.com/doc/refman/5.1/zh/partitioning.html#partitioning-overview 阅读全文
posted @ 2012-04-14 09:18 Athrun 阅读(273) 评论(0) 推荐(0)
摘要:From : http://www.yeephp.com/study/919.htmlPHPExcel是相当强大的 MS Office Excel 文档生成类库,当需要输出比较复杂格式数据的时候,PHPExcel 是个不错的选择。经过认真研究API文档和查看官方文档,终于找到读取EXCEL中的图片,目前我只能读取excel 2003格式的。excel2007貌似还不支持。其中主要使用的API为PHPExcel_Worksheet,PHPExcel_Worksheet_BaseDrawing,PHPExcel_Worksheet_MemoryDrawing。废话少说,直接上代码:require_ 阅读全文
posted @ 2012-04-11 16:35 Athrun 阅读(1079) 评论(0) 推荐(0)
摘要:From : http://apps.hi.baidu.com/share/detail/23157364常用的用PHP读取EXCEL的方法有以下三种,各自有各自的优缺点。个人推荐用第三种方法,因为它可以跨平台使用。1. 以.csv格式读取将.xls转换成.csv的文本格式,然后再用PHP分析这个文件,和PHP分析文本没有什么区别。优点:跨平台,效率比较高、可以读写。缺点:只能直接使用.csv的文件,如果经常接受.xls二进制文件的话需要手工转换,不能自动化。一个文件只有一个SHEET。PHP有自带的分析.csv函数:fgetcsvarray fgetcsv ( int $handle [, 阅读全文
posted @ 2012-04-11 16:29 Athrun 阅读(731) 评论(0) 推荐(0)
摘要:转自:http://hi.baidu.com/avauntage/blog/item/b7a8ca16e7245017972b43bb.html1 引言Mysql的触发器和存储过程一样,都是嵌入到mysql的一段程序。触发器是mysql5新增的功能,目前线上凤巢系统、北斗系统以及哥伦布系统使用的数据库均是mysql5.0.45版本,很多程序比如fc-star管理端,sfrd(das),dorado都会用到触发器程序,实现对于数据库增、删、改引起事件的关联操作。本文介绍了触发器的类型和基本使用方法,讲述了触发器使用中容易产生的误区,从mysql源码中得到触发器执行顺序的结论,本文最后是实战遭遇的 阅读全文
posted @ 2011-11-17 14:52 Athrun 阅读(434) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页