Time of Update: 2016-07-25
require 'Net/SMTP.php';$host = '126.com';//smtp伺服器的ip或網域名稱$username= 'arcow';//登陸smtp伺服器的使用者名稱$password= 'secret';//登陸smtp伺服器的密碼$from = 'jbxue@126.com'; //誰發的郵件$rcpt = array('test@test.com', 'jbxue@126.com');//可設多個接收者$subj = "Subject:
Time of Update: 2016-07-25
class TestController extends Lyw0301_Controller_Action { public function init() { parent::init(); $this->view->title = '測試'; $this->view->baseUrl = $this->getFrontController()->getBaseUrl(); // $this->_helper->viewRenderer->setNoRender();
Time of Update: 2016-07-25
class ImageReport{ var $X;//圖片大小X軸 var $Y;//圖片大小Y軸 var $R;//背影色R值 var $G;//...G. var $B;//...B. var $TRANSPARENT;//是否透明1或0 var $IMAGE;//圖片對像 //------------------- var $ARRAYSPLIT;//指定用於分隔數值的符號 var $ITEMARRAY;//數值 var
Time of Update: 2016-07-25
$base_url = 'http://bbs.it-home.org/';$client = new Zend_Rest_Client($base_url);// 設定全域變數$headers = array();$client->headers($headers);// 遠程調用, 調用sayHello介面,傳遞兩個字串參數$response = $client->sayHello('Hello', 'world!')->get();if
Time of Update: 2016-07-25
class FruitQuoteService{ public $__dispatch_map = array(); public $__typedef = array(); public function FruitQuoteService() { $this->__dispatch_map['getQuote'] = array( "in" => array("category" => "string"), "out" =>
Time of Update: 2016-07-25
$users = array( array('name' => 'tom', 'age' => 20) , array('name' => 'anny', 'age' => 18) , array('name' => 'jack', 'age' =>
Time of Update: 2016-07-25
/*** Socket版本* 使用方法:* $post_string = "app=socket&version=beta";* request_by_socket('www.1bo8.cn','/restServer.php',$post_string);*/function request_by_socket($remote_server,$remote_path,$post_string,$port = 80,$timeout = 30){ $socket = fsockopen($
Time of Update: 2016-07-25
/** * parent 只能調用父類中的公有或受保護的方法,不能調用父類中的屬性 * self 可以調用父類中除私人類型的方法和屬性外的所有資料 */class User{ public $name; private $passwd; protected $email; public function __construct(){ //print __CLASS__." "; $this->name= 'simple';
Time of Update: 2016-07-25
$zip = zip_open("20101105.zip");if ($zip) { while ($zip_entry = zip_read($zip)) { echo "Name: " . zip_entry_name($zip_entry) . ""; echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . ""; echo "Compressed Size: " .
Time of Update: 2016-07-25
$params = array('host' => 'localhost', 'port' => '25', 'username' => 'test@jbxue.com', 'password' => 'test'); //$to = $test_mail; $recipients = $to; 接收人,可以是一個數組來存放多個地址 $headers['From'] = $email;
Time of Update: 2016-07-25
phpmailer 發送郵件類庫 header('Content-Type: text/html; charset=utf-8');require("phpmailer/class.
Time of Update: 2016-07-25
/*功能實用的php分頁類subpages*/class SubPages{ private $each_disNums;//每頁顯示的條目數 private $nums;//總條目數 private $current_page;//當前被選中的頁 private $sub_pages;//每次顯示的頁數 private $pageNums;//總頁數 private $page_array = array();//用來構造分頁的數組 private $subPage_link;/
Time of Update: 2016-07-25
$keywordArray = array( array('進程', 'http://www.01happy.com/linux-ps-view-process/') ,array('守護進程', 'http://www.01happy.com/linux-python-daemon/'));複製代碼二維數組排序可以使用內建函數usort,代碼如下: usort($keywordArray, function($a, $b) { $al = strlen($a[0]);
Time of Update: 2016-07-25
empty 和 isset 雖然都是變數處理函數,它們都用來判斷變數是否已經配置,它們卻是有一定的區別:empty還會檢測變數是否為空白、為零。當一個變數值為0,empty 認為這個變數同等於空,即相當於沒有設定。 /*比如檢測 $id 變數,當 $id=0 時,用empty 和 isset 來檢測變數 $id 是否已經配置,兩都將返回不同的值—— empty
Time of Update: 2016-07-25
require_once('pclzip.lib.php');$zip = new PclZip("archive.zip");$v_list = $zip->create($_SERVER['DOCUMENT_ROOT'] ,PCLZIP_OPT_REMOVE_PATH,$_SERVER['DOCUMENT_ROOT']);if($v_list == 0){ echo '異常:'.$z->errorInfo(true); }else { echo '備份成功'; }?>複製代碼其它用法舉例:
Time of Update: 2016-07-25
貌似記得以前傳過一個,是我自己寫的,今天這個是網上的,來自:http://www.cnblogs.com/zcy_soft/archive/2010/12/13/1904791.html
Time of Update: 2016-07-25
完整php類,通常我會配合smary使用,快捷使用 (plugins/function.rdate.php) /* * Data time functions. // * 模組 */defined('TSKY') || die('Permission Denied!');function fmtMonth($month){return date('F,
Time of Update: 2016-07-25
IIS下 PHP FastCgi的問題 require路徑緩衝的問題 require系列函數包含相對路徑相同 /*IIS下 PHP FastCgi的問題require路徑緩衝的問題 require系列函數包含相對路徑相同
Time of Update: 2016-07-25
PHP擷取漢字拼音首字母函數 轉自www.54dev.com /** * @param unknown_type $str * @return 取得漢字的首字母 */function getfirstchar($str){ $fchar=$str[0]; //判斷是否為字串 if(ord($fchar)-->=ord("A") && ord($fchar)
Time of Update: 2016-07-25
php實現對文本資料庫的資料顯示、加入、修改、刪除、查詢五大基本操作的方法 此文本資料庫共有欄位9個: private $bankid; //銀行ID private $bankname; //銀行名稱 private $bankimg; //銀行圖片 private $bankarea; //覆蓋地區 private $bankcard; //受理卡種 private $banklimit; //支付限額 private $bankpasswd; /