——phpͼÏñ´¦ÀíÀà
<?
* +-------------------------------------------------------------+
* | Copyright (c) 2008-2009 Diqiye.Com All rights reserved.
* +-------------------------------------------------------------+
* | Info : ͼÏñ´¦ÀíÀà
* +-------------------------------------------------------------+
*/
class image {
// µ±Ç°Í¼Æ¬
protected $img;
// ͼÏñtypes ¶ÔÓ¦±í
protected $types = array(
1 => 'gif',
2 => 'jpg',
3 => 'png',
6 => 'bmp'
);
// image
public function __construct($img=''){
!$img && $this->param($img);
}
// Info
public function param($img){
$this->img = $img;
return $this;
}
// imageInfo
public function getImageInfo($img){
$info = @getimagesize($img);
if(isset($this->types[$info[2]])){
$info['ext'] = $info['type'] = $this->types[$info[2]];
} else{
$info['ext'] = $info['type'] = 'jpg';
}
$info['type'] == 'jpg' && $info['type'] = 'jpeg';
$info['size'] = @filesize($img);
return $info;
}
// thumb(ÐÂͼµØÖ·, ¿í, ¸ß, ²Ã¼ô, ÔÊÐí·Å´ó)
public function thumb($filename,$new_w=160,$new_h=120,$cut=0,$big=0){
// »ñÈ¡ÔͼÐÅÏ¢
$info = $this->getImageInfo($this->img);
if(!empty($info[0])) {
$old_w = $info[0];
$old_h = $info[1];
$type = $info['type'];
$ext = $info['ext'];
unset($info);
// Èç¹ûÔͼ±ÈËõÂÔͼС ²¢ÇÒ²»ÔÊÐí·Å´ó
if($old_w < $new_h &a
Ïà¹ØÎĵµ£º
<?php
class ClientGetObj{
function getOS(){
global $_SERVER;
$agent=$_SERVER["HTTP_USER_AGENT"];
$os=false;
if(eregi("win",$agent)&&strpos($agent,"95")){
$os="Windows 95";
}else if(eregi("win 9x",$agent)&&strpos($agent,"4.90")){
$os="Windows ME";
}else ......
PHPÊÇÈõÀàÐÍÓïÑÔ¡£
»ù±¾Êý¾ÝÀàÐÍ£ºinteger¡¢string¡¢boolean¡¢float
¸´ºÏÊý¾ÝÀàÐÍ£ºarray¡¢object
»ù±¾Êý¾ÝÀàÐ;Ͳ»ËµÁË£¬ÏÂÃæ¿´Ò»¸öÊý×éÏà¹ØµÄһЩÀý×Ó¡£
$test1=array(1,2,3,4);//¶¨ÒåÁËÒ»¸ö°üº¬4¸öÊýµÄÊý×é
$test1=array("new1"=>1,"new2"=>2);//Á½¸ö±äÁ¿µÄÊý×é,array['new1']=1,array['new2']=2
¶àÎ ......
ÒòΪÏîÄ¿ÐèÒª£¬ËùÒÔ×Ô¼ºÐ´ÁËÒ»¸öCRUDÀà
ËäÈ»»¹±È½Ï¼òµ¥£¬²»¹ý¸Ð¾õºÜʵÓá£
×¢£ºcls_databaseÊÇÒ»¸öÊý¾Ý¿â²Ù×÷Àà
¼û£ºhttp://code.google.com/p/cyy0523xc/source/browse/trunk/php/cls_crud.php
<?php
/**
* ×Ô¶¯»¯Êý¾Ý±í²Ù×÷Àà
* @author С²Ì <cyy0523xc@gmail.com>
* @version 1.0
*/
class cls_ ......
PhpÁ¬½ÓmysqlµÄº¯ÊýÈçÏ£º
mysql_connect("Ö÷»úÃû","Óû§Ãû","ÃÜÂë");//´ò¿ªÒ»¸öÁ¬½Ó
mysql_select_db("´ò¿ªÊý¾Ý¿â",Á¬½Ó±êʶ·û);//´ò¿ªÒ»¸öÊý¾Ý¿â
$conn=@mysql_connect("localhost","root","") or die("Á´½Ó´íÎó");ÕâÀï@¿ÉÒÔÒþ²Ø´íÎóÌáʾ,or die¿ÉÒÔÔÚ´íÎóµÄʱºòÏÔʾ¡£
Ö´ÐÐsqlÓï¾äµÄº¯Êý:
mysql_query();
$sql= ......
a - СдµÄam»òpm
A - ´óдµÄAM»òPM
d - ÈÕ£¬Á½Î»Êý×Ö£¬²»×ãÁ½Î»ÔòÇ°µ¼×Ô¶¯²¹Áã
D - ±íʾÐÇÆÚµÄÓ¢ÎĵÄÇ°Èý¸öÓ¢ÎÄ×Öĸ
F - Ô·ݵÄÓ¢ÎÄÈ«Ãû
h - 12СʱÖÆ£¬Á½Î»Êý×Ö£¬²»×ãÁ½Î»ÔòÇ°µ¼×Ô¶¯²¹Áã
H - 24СʱÖÆ£¬Á½Î»Êý×Ö£¬²»×ãÁ½Î»ÔòÇ°µ¼×Ô¶¯²¹Áã
g - 12СʱÖÆ£¬²»×ãÁ½Î»µÄСʱ²»²¹Áã
G - 24СʱÖÆ£¬²»×ãÁ½Î»µÄСʱ²»²¹Áã ......