Time of Update: 2017-01-13
本文章提供這款圖片處理類,他可以做的事情有把圖片產生縮圖,可能給圖片增加浮水印以及擷取圖片資訊,算是比較實用代碼又簡潔的函數*/ 代碼如下複製代碼 class image{ public $info=array(); function __construct() { !extension_loaded('gd') && exit("www.111cn.net提示:伺服器環境不支援gd庫")
Time of Update: 2017-01-13
本文章提供一款php教程產生驗證碼詳細教程,前面是講關於產生驗證核心代碼,後面是一款產生與調用的方法。 代碼如下複製代碼 <?php //header("content-type:image/png"); $num ='1234'; $imagewidth=60; $imageheight=18;$numimage = imagecreate($imagewidth,$imageheight);
Time of Update: 2017-01-13
<?php class simpleimage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == imagetype_jpeg ) { $this->image =
Time of Update: 2017-01-13
imagemagic官方去除圖片背景的命令列模式: 代碼如下複製代碼 convert -size 140x80 xc:none -fill grey -gravity northwest -draw "text 10,10
Time of Update: 2017-01-13
代碼如下複製代碼 <?php$imagedraw = new imagick();$pixel = new imagickpixel('gray');$pixel->setcolor('black');$imagedraw->newimage(100, 75, $pixel);$draw = new imagickdraw();$draw->setfont('bookman-demiitalic');$draw->setfontsize(12);$
Time of Update: 2017-01-13
代碼如下複製代碼 function fun_code($sessionname){ header("content-type:image/png"); session_start(); $authnum_session = ''; //$str = 'abcdefghijkmnpqrstuvwxyz1234567890'; $str = '1234567890'; $l = strlen($str)
Time of Update: 2017-01-13
代碼如下複製代碼 $ch_str="你要產生中文驗證碼漢字";$str=array();for ($i=0;$i<strlen($ch_str);$i+=3){ $str[]=$ch_str[$i].$ch_str[$i+1].$ch_str[$i+2];}//圖片的長和高$image_x=200;$image_y=100;$im =
Time of Update: 2017-01-13
<? header ("content-type: image/png"); 代碼如下複製代碼 $newimg = imagecreate(250,250); 由於映像還是空白的,因此你可能會希望用一些彩色來填充它。你需要首先使用imagecolorallocate()函數用其rgb值為這種顏色指定一個名字,這一函數的格式為imagecolorallocate([image], [red], [green],
Time of Update: 2017-01-13
.jpgraph開源項目介紹jpgraph是一個物件導向圖形建立函數庫。可用它來產生柱狀圖,餅狀圖,甘特圖,網狀圖等常用到的一些圖形。支援的圖片格式有gif,jpg和png。jpgraph是一個開源的利用php教程編寫的專門提供圖表的類庫。它使得作圖變成了一件非常簡單的事情,你只需從資料庫教程中取出相關資料,定義標題,圖表類型等內容,你只需要學習掌握為數不多的jpgraph內建函數(可以參照jpgraph附帶例子學習),利用簡單的幾行代碼就可以做出超酷超炫的圖表來!2.jpgraph下載安裝及使
Time of Update: 2017-01-13
代碼如下複製代碼 function uploadimage($upname,$smallmark=1,$dstsw,$dstsh=0,$path_dim,$path_xim,$newname,$smallname=0,$filetype="null") { global $webaddr,$_files,$my; $phpv=str_replace('.', '',
Time of Update: 2017-01-13
代碼如下複製代碼 function resizeimage($image,$width,$height,$scale) { list($imagewidth, $imageheight, $imagetype) = getimagesize($image); $imagetype = image_type_to_mime_type($imagetype); $newimagewidth = ceil($width * $scale); $
Time of Update: 2017-01-13
代碼如下複製代碼 class securecode{ private static $instance=null; private $code = ''; private $fontfile; private $validate; private $image;
Time of Update: 2017-01-13
自訂函數實現金字塔 代碼如下複製代碼 <?php/** * 金字塔 * string fun_py(int $rows = 9, bool $sort=true) * $rows 表示行數 必須為整數 並且必須在1-20之間 * $sort 表示排序 true表示正序 FALSE表示倒序 */function fun_py($rows = 9, $sort=true){ if ($rows<1 ||
Time of Update: 2017-01-13
代碼如下複製代碼 <?php/** * * @author http://www.111cn.net * Created on 2014-4-1 * @param array $array * @param int [optional] $length * @return array */function
Time of Update: 2017-01-13
代碼如下複製代碼 <?php/**用PHP判斷遠程圖片(檔案)是否存在*http://www.111cn.net*/function check_remote_file_exists($url) { $curl = curl_init($url); // 不取回資料 curl_setopt($curl, CURLOPT_NOBODY,
Time of Update: 2017-01-13
其實主要就是用到了php的strtotime這個函數,strtotime('n day'),樣本如下: 代碼如下複製代碼 $days=array();for($i=0;$i<=7;$i++){ //這裡數字根據需要變動 $days[]=date("Y-m-d",strtotime('-'.$i.'day'));}echo '<pre>';print_r($days); 結果將顯示如下: 代碼如下複製代碼
Time of Update: 2017-01-13
例子 代碼如下 複製代碼 echo $str = 'PHP點點通'; echo strlen($str); //3*1+3*3=12 echo mb_strlen($str, 'gb2312'); //3*1+3*2=9 echo
Time of Update: 2017-01-13
在沒有購物商品直接進入購物車時竟然出現警告提示錯誤提示:Warning: Invalid argument supplied for foreach() in E:wampwwwmyshopcart.php on line 95 解決方案:就是在迴圈前面加上判斷直接使用is_array判斷給的值是不是為數組 代碼如下 複製代碼
Time of Update: 2017-01-13
學PHP的都瞭解,在PHP中擷取字串有一個strlen內建函數;這裡和大家分享一個在一些特定情況下判斷字串長度較為高效的方式;來看下面兩段代碼的執行效率吧,自己理解理解代碼的執行思路: 代碼如下複製代碼 <?php //使用strlen方式 $arr = '123456'; $sTime = microtime(1);
Time of Update: 2017-01-13
在網上找了這方面的教程 但是基本就是沒有人說什麼 然後在某一天看見一個PHP程式設計出了一張類似這樣的資料庫設計圖之後就有了很多領悟!下面是資料庫的結構圖 下面我們就來繼續一下介紹