php實現檔案下載!

實現php檔案安全下載! public function downloads($name){ $name_tmp = explode("_",$name); $type = $name_tmp[0]; $file_time = explode(".",$name_tmp[3]); $file_time = $file_time[0]; $file_date = date("Y/md",$file_time);

10個技巧最佳化PHP程式Laravel 5架構

效能一直是 Laravel 架構為人詬病的一個點,所以調優 Laravel 程式算是一個必學的技能。  接下來分享一些開發的最佳實務www.itxdl.cn,還有調優技巧,大家有別的建議也歡迎留言討論。  這裡是簡單的列表:  配置資訊緩衝 artisan config:cache  路由緩衝 artisan route:cache  類映射載入最佳化 artisan optimize  自動載入最佳化 composer dumpautoload  使用 Memcached 來儲存會話

PHP發送POST請求的三種方式

[PHP]代碼 class Request{ public static function post($url, $post_data = '', $timeout = 5){//curl $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); if($post_data != ''){

php遍曆目錄,組建目錄下每個檔案的md5值並寫入到結果檔案中

/** * @author Administrator * */class TestGenerate {public static $appFolder = "";public static $ignoreFilePaths = array ("xxxx/xxx.php" );public static function start() {$AppPath = "E:\\myApp";TestGenerate::$appFolder = $AppPath;$destManifestPath

PHP 漢字轉拼音源碼(GB2312類庫,大約支援6000個漢字左右)

最近一個項目中使用php作為為前端提供資料的開發語言,為了實現能夠按照字母排序,需要提取中文的漢語拼音,借這個項目寫了個漢字轉拼音的指令碼,指令碼比較簡單,注釋也比較詳細,這裡就不多說了,直接上代碼了。 使用方法: $py = new PinYin(); $all_py = $py->get_all_py("吳國偉"); //輸出 ['wu','guo','wei'],輸出字串調用join方法,join('',$all_py) $first_py =

基於php和mysql的簡單的dao類

SimpleDao.class //require_once('FirePHPCore/FirePHP.class.php'); //$firephp = FirePHP::getInstance(true); // debugger in firefox class SimpleDao { private $_table = null; private static $_con = null; public

PHP人民幣小寫轉大寫

[PHP]代碼 /** * 人民幣小寫轉大寫 * * @param string $number 數值 * @param string $int_unit 幣種單位,預設"元",有的需求可能為"圓" * @param bool $is_round 是否對小數進行四捨五入 * @param bool $is_extra_zero 是否對整數部分以0結尾,小數存在的數字附加0,比如1960.30, *

php 判斷訪問IP

判斷訪問IP php代碼 function getIP() { if (! empty ( $_SERVER ["HTTP_CLIENT_IP"] )) { $cip = $_SERVER ["HTTP_CLIENT_IP"]; } else if (! empty ( $_SERVER ["HTTP_X_FORWARDED_FOR"] )) { $cip = $_SERVER ["HTTP_X_FORWARDED_FOR"]; }

PHP使用curl偽造IP地址和header資訊

curl雖然功能強大,但是只能偽造$_SERVER["HTTP_X_FORWARDED_FOR"],對於大多數IP地址檢測程式來說,$_SERVER["REMOTE_ADDR"]很難被偽造: 首先是client.php的代碼 01 $headers['CLIENT-IP'] = '202.103.229.40'; 02

php 十個超級有用的PHP程式碼片段

十個超級有用的php程式碼片段 [PHP]代碼 1. 傳送簡訊調用 TextMagic API。// Include the TextMagic PHP librequire('textmagic-sms-api-php/TextMagicAPI.php');// Set the username and password information$username = 'myusername';$password = 'mypassword';// Create a new

PHP實現md5檢驗檔案

[PHP]代碼 //blog.qita.inecho 'md5檢驗[目錄直接md5目錄名稱,檔案就md5_file整個檔案的內容]';$filename = "test.txt";if(is_dir($filename)){ $md5file = md5($filename);}else{ $md5file = md5_file($filename);}echo $md5file;//儲存原始檔案的md5值到md5file.txt檔案//file_put_contents("md5

php實現telnet功能

使用php來實現telnet的串連、傳遞命令、擷取傳回值等功能! telnet.php error_reporting(-1);class Telnet { var $sock = NULL; function telnet($host,$port) { $this->sock = fsockopen($host,$port); socket_set_timeout($this->sock,2,0); } function close() { if ($this->sock)

php擷取漢字首字母

php擷取首字母 [PHP]代碼 $d = array( array("a",-20319), array("ai",-20317), array("an",-20304), array("ang",-20295), array("ao",-20292), array("ba",-20283), array("bai",-20265), array("ban",-20257),

一個簡單、純潔的PHP分頁類

他的特點:單純,接受參數,給出分頁;靈活:可以自己決定,上、下一頁的名稱(比如我想叫prev、nex t諸如此類)可以決定每頁展示的分頁數量,跨頁數提供一個封裝方法,適應不同的網頁結構,比如有的網頁我需要每個分頁包含一個li(1 ...),依次類推備忘說明:提供的示範代碼中有兩個靜態方法大家可以不必理會。這個是自己項目開發用的。Call::import,大家可以使用include代

PHP的http請求處理類

[PHP]代碼 /** * http請求處理類(基於CURL進行封裝) * * @author Xiwei Ye * @version $Id$ */class cls_http_request{ /** * get方式請求(curl) * * @param string $url 請求的url * @param integer $timeout 逾時時間(s) * @return string(請求成功)

php操作mysql的類

[PHP]代碼 class mysql { private $db_host; //資料庫主機 private $db_user; //資料庫使用者名稱 private $db_pwd; //資料庫使用者名稱密碼 private $db_database; //資料庫名 private $conn; //資料庫連接標識; private $result; //執行query命令的結果資源標識 private $sql; //sql執行語句

PHP的PDO資料庫操作類

一個簡單的PDO類封裝。。僅供學習交流 PdoDb 資料庫類 /** * @throws Error * PDO資料庫 */class PdoDb extends DatabaseAbstract{ /** * PDO執行個體 * @var PDO */ protected $DB; /** * PDO準備語句 * @var PDOStatement */ protected $Stmt; /** *

封裝了get post 方法的PHP代碼

[PHP]代碼 function g($name, $defaultValue = "") { // php這裡區分大小寫,將兩者都變為小寫 $_GET = array_change_key_case ( $_GET, CASE_LOWER ); $name = strtolower ( $name ); $v = isset ( $_GET [$name] ) ? $_GET [$name] : ""; if ($

php 使用PHPEXcel匯出表資料

項目中需要將表中的資料匯出,在網上找了找發現phpexcel蠻好用的.特此分享 PHPEXCEL if(!defined('BASEPATH')) exit('No direct script access allowed');//物資發料單明細class Read_write{ /** * $name:選擇的類型(CSV,EXCEL2003,2007) * $titles:標題數組 * $querys:查詢返回的數組 $query->result_

php 擷取當天或某個日期是星期幾

效果:今天是:星期五今天是:禮拜五2010-12-12是:禮拜日 [PHP]代碼 function getWeekName($data,$format = '星期'){ $week = date( "D ",$data); switch($week) { case "Mon ": $current = $format."一"; break; case "Tue ":

總頁數: 5203 1 .... 1697 1698 1699 1700 1701 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.