摘要: 贴图库是什么贴图库 — 免费、高速、稳定、专业图片外链有什么用打算直接做个小博客, 可以很好的解决图片存储的问题, 关键是免费。准备工作官网免费注册账号 http://www.tietuku.com获得公钥和秘钥AccessKey: d37a4%%%%%%%%%%8bb33871¥¥¥¥¥¥¥¥¥S... 阅读全文
posted @ 2014-11-12 09:55 刘牛德 阅读(135) 评论(0) 推荐(0)
摘要: 同一个目录下两个文件,一个 index.php一个 cal.php1. cal.php 内容如下<?php // 当 $month=0的时候,显示全年的日历 function get_data($year, $month) { $ans = array(); // 或者时间截 $time = mktime(0, 0, 0, $month, 1, $year); // 计算这个月有几天 $n_days = cal_days_in_month(CAL_GREGORIAN, $month, $year); ... 阅读全文
posted @ 2013-04-12 15:40 刘牛德 阅读(117) 评论(0) 推荐(0)
摘要: <html> <head> <title>日历测试</title> <meta charset="utf-8"> </head> <body> <?php // 当 $month=0的时候,显示全年的日历 function get_data($year , $month ) { $ans = array(); // 或者时间截 $time = mktime(0,0,0,$mont... 阅读全文
posted @ 2013-04-12 12:07 刘牛德 阅读(195) 评论(0) 推荐(0)
摘要: <?php class A { public $config = array( "name" => "senlin", ); // 读取未定义的便利的时候就是调用这个方法。 public function __get($name){ if(isset($this->config[$name])) { return $this->config[$name]; } return null; ... 阅读全文
posted @ 2013-04-08 11:04 刘牛德 阅读(104) 评论(0) 推荐(0)
摘要: 1. html 代码如下<html> <head> <style> div {margin: 0px; padding: 0px;} #a001{width: 100px; height: 100px; margin:0 auto; border-color:red; border-style: solid; border-width: 30px;} #a002{width: 100px; height: 100px; margin:0 auto; border-color:red; border-style... 阅读全文
posted @ 2013-03-27 14:22 刘牛德 阅读(451) 评论(0) 推荐(0)
摘要: 1. 一个简介的例子 , 调用一个函数1 <?php2 function test() {3 echo "test()";4 }5 6 register_shutdown_function(array("test"));7 echo "show: ";8 ?>这个例子输出 show: test() , 这个函数的作用就是在退出脚本前,调用已经注册的函数,并执行该函数。2. 在类中用一个数组作为一个参数<?php class ClassDemo { public function __construct() { ... 阅读全文
posted @ 2013-03-22 15:37 刘牛德 阅读(150) 评论(0) 推荐(0)
摘要: 1. php 中的高级分离术<?php if(1+2 > 3) { ?> 1+2 > 3<?php } else { ?> 1+2 <= 3<?php } ?>2. php 支持9种基本的数据类型 1)四种标量 boolean, integer, float(doule), string 2) 两种符合类型 array 和 object 3) 三种特殊类型 resource, null, callable 为类型 1) mixed 2)number, 3)callback callback 可以接受函数或者方法。 php 的变量不是有程序员 阅读全文
posted @ 2013-03-16 11:30 刘牛德 阅读(147) 评论(0) 推荐(0)
摘要: // 工厂函数 // 自动加载一个类 class Example { public static function factory ($type) { if(include_once "./".$type.".php") { $classname = $type; return new $classname; } else { throw new Exception("file not find"); } } ... 阅读全文
posted @ 2013-03-16 10:43 刘牛德 阅读(154) 评论(0) 推荐(0)
摘要: <?php // __autoload 当使用未定义的类的时候,会自动调用这个函数。 // 比如在本文件的同目录下有个 classOne.php 文件,这个文件中有个 classOne 类。 function __autoload($s) { require_once __DIR__."./$s".".php"; } $obj = new classOne(); $obj->f();?> 阅读全文
posted @ 2013-03-15 16:39 刘牛德 阅读(151) 评论(0) 推荐(0)
摘要: function ff() { echo __FUNCTION__; // output : ff } class MyClass { static public function fclass() { echo __CLASS__; // MyClass echo "<br/>"; echo __METHOD__; // MyClass::fclass } } echo __FILE__; // output : c:\web... 阅读全文
posted @ 2013-03-15 16:25 刘牛德 阅读(113) 评论(0) 推荐(0)