Time of Update: 2017-01-13
代碼如下複製代碼 class resizeimage { //圖片類型 var $type; //實際寬度 var $width; //實際高度 var $height;
Time of Update: 2017-01-13
例1 代碼如下複製代碼 <?phpHeader("Content-type: image/png"); /*通知瀏覽器,要輸出映像*/$im = imagecreate(400 , 300); /*定義映像的大小*/$gray
Time of Update: 2017-01-13
代碼如下複製代碼 header("Content-type:image/png");set_time_limit(0);//設定PHP逾時時間$url = $_GET['url'];$url = "http://vcer.baidu.com/verify";$imginfo = GetImageSize ( $url ); $imgw = $imginfo [0]; $imgh =
Time of Update: 2017-01-13
網上有很多朋友用phpmailer組件發送郵件提示:Could not instantiate mail function.錯誤,解決方案少之用少,原因是伺服器沒有安裝sendmail組件,使用yum進行安裝:yum install sendmail/etc/init.d/sendmail start 注意:如果sendmail啟動緩慢,請將hostname加入到/etc/hosts裡面
Time of Update: 2017-01-13
使用mail方法發信時,如果標題或寄件者含有中文就會造成亂碼,而本文不會。解決辦法如下先用函數base64_encode() ? 使用 MIME base64 對資料進行編碼 標題字串前加編碼類別型例如: =?UTF-8?B? 標題字串後加:?= 郵件header說明Content-type ? 防止郵件內文也亂碼首先在報文頭加入聲明 //如果你的網站是GBK,下面將utf-8改為gbk$headers = 'MIME-Version: 1.0' . "\r\n&
Time of Update: 2017-01-13
1.首先是下載PHPMailer 2.解壓 從中取出class.phpmailer.php 和 class.smtp.php 放到你的項目的檔案夾,因為我們等下會引用到它們. 3.建立發送郵件的函數,其中你需要配置smtp伺服器 function postmail($to,$subject = '',$body = ''){ //Author:smsyun WebSite:
Time of Update: 2017-01-13
PHP XML處理XML代碼如下 代碼如下複製代碼 <?xml version="1.0" encoding="UTF-8"?><!-- Edited with XML Spy v2007 (http://www.altova.com) --><breakfast_menu> <food
Time of Update: 2017-01-13
代碼 代碼如下複製代碼 <?php/*** to show <title lang="en"><![CDATA[Site Title]]></title> instead of <title lang="en">Site Title</title>**/class SimpleXMLExtended extends
Time of Update: 2017-01-13
例1 代碼如下複製代碼 <?php//Store your html into $html variable.$html="<html><head><title>Rakesh Verma</title></head><body> <a
Time of Update: 2017-01-13
windows系統GD庫開啟將php.ini檔案找到extension=php_gd2.dll 去掉前面的;就行了linux系統GD庫開啟##檢測GD庫是否安裝命令 php5 -m | grep -i gd 或者 php -i | grep -i --color gd##如未安裝GD庫,則為伺服器安裝,方法如下### 如果是源碼安裝,則加入參數 --with-gd###
Time of Update: 2017-01-13
原理:1.首先計算出原圖片的尺寸2.建立相同尺寸的半透明圖片3.使用 imagecopy()方法,把新建立的半透明圖片與原圖合并 代碼如下複製代碼 <?php /*php 給圖片加灰色透明效果*/$imfile = './0.jpg';//原圖 $origim = imagecreatefromjpeg($imfile);//從 JPEG 檔案或 URL 建立一映像 $w=imagesx($origim);//原圖寬度
Time of Update: 2017-01-13
代碼如下 複製代碼 function createsortoptions ($selected=0,$parent_id=0,$n=-1) { global $db; $sql = "select * from `@__article_sort` where `parent_id` = '{$parent_id}'";
Time of Update: 2017-01-13
//連結資料庫 代碼如下複製代碼 $localhost ='127.0.0.1';//mssql資料庫ip $sa ='sa';//mssql登入使用者名稱 $pwd='123';//串連密碼 $db = 'cs';//資料庫 $conn=mssql_connect($localhost,$sa,$pwd) or die('mssql資料庫連接失敗');
Time of Update: 2017-01-13
inport.php 代碼如下複製代碼 <?php /** * Database Backup程式 * * @author:黃樂 * @version:1.0 * @lastupdate:2010-7-19 *
Time of Update: 2017-01-13
1. output handler ‘ob_gzhandler’ conflicts with ‘zlib output compression’PHP Warning: ob_start() [ref.outcontrol]: output handler ‘ob_gzhandler’ conflicts with ‘zlib output compression’ in yourfilesTry
Time of Update: 2017-01-13
我們先來講述一下利用session來登入登入頁面05.php的代碼如下: 代碼如下複製代碼 <?php session_start() ; //初始化sessionif (isset
Time of Update: 2017-01-13
我們先來看看關於file_exists的用法file_exists() 函數檢查檔案或目錄是否存在。如果指定的檔案或目錄存在則返回 true,否則返回 false。文法file_exists(path)參數 描述 path 必需。規定要檢查的路徑。 例子<?phpecho file_exists("test.txt");?>輸出:1按這個原理 我在smarty模板開始工作如下介紹 我發現了一個問題,今天與大家分享。我把整個流程說明一下。 問題&
Time of Update: 2017-01-13
php5後都要自己設定時區,要麼修改php.ini的設定,要麼在代碼裡修改。 在PHP.INI中設定時區 代碼如下複製代碼 date.timezone = PRC 在代碼中設定時區 代碼如下複製代碼 date_default_timezone_set('PRC');//其中PRC為“中華人民共和國” 上面可以滿足我們需求。系統初始化時,加上 代碼如下複製代碼 ini_set('date.
Time of Update: 2017-01-13
1. 錯誤提示引用 代碼如下複製代碼 Warning: Cannot send session cookie - headers already sentWarning: Cannot send session cache limiter - headers already sent 分析及解決辦法這一類問題,的原因是你在程式中使用session_start()時,之前已經有實際的html內容輸出了。或許你說,我沒有啊,我只不過是echo或
Time of Update: 2017-01-13
注意:在設定301重新導向之前務必備份相應目錄下的.htaccess檔案。1.301重新導向b.org到www.b.org這種重新導向旨在使網域名稱唯一,是網站SEO必須要做的,後面重新導向www.b.org到b.org也是出於同樣的原因,只是形式不同。開啟.htaccess檔案,加入以下規則。(下面的規則是針對主網域名稱的,子網域名稱要修改) 代碼如下複製代碼 RewriteEngine OnRewriteCond %{HTTP_HOST} !^www.b.org$