phpExcel類的使用方法分享

include ‘PHPExcel.php'; include ‘PHPExcel/Writer/Excel2007.php'; //或者include ‘PHPExcel/Writer/Excel5.php'; 用於輸出.xls的 建立一個excel $objPHPExcel = new PHPExcel(); 儲存excel—2007格式 $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); //或者$objWriter =

PHP表單POST傳參數時自動加逸出字元問題的解決方案

本文介紹下,在php中表單post方式傳遞參數時,自動逸出字元問題的解決方案,有需要的朋友參考學習下。問題描述:由表單輸入mysql語句,然後提交給PHP程式,由PHP程式做相應的查詢並返回結果,在使用時發現如果在表單中輸入有特殊字元(如'' "" \等)時,PHP會自動在它們的前面加上逸出字元 "\",但是一旦它加上以後,則無法再用這條語句做sql查詢了。解決方案:在表單中輸入:select * from

PHP 資料庫讀寫分離的經典例子

/*** mysql讀寫分離* edit: bbs.it-home.org*/class db { public function __construct($sql) { $chestr = strtolower(trim($sql)); //判斷sql語句有select關鍵字的話,就串連讀的資料庫,否則就串連寫資料庫 if(substr($chestr,0,6)=='select') {

php $$特殊變數(輸出變數字串對應變數的值)

$var1 = 'nameOfVariable';$nameOfVariable = 'This is the value I want!';echo $$var1; ?>複製代碼輸出結果: This is the value I want!您可能感興趣的文章:PHP可變變數安全的執行個體詳解php

phpDatabase Backup類 分享一個不錯的phpDatabase Backup類

error_reporting(0);//消滅萬惡的php警示提示//設定郵箱$options = array('email' => array('email1', 'email2'),'folder' => './backup/','mysql' => array('localhost', 'user', 'password', 'db')); $b = new Backup($options); // 提交備份命令 if(isset($_POST['backup'])) { //

PHP日期處理的小例子 mysql按日期、時間查詢的例子

//php日期處理date_default_timezone_set('PRC'); //預設時區 echo "今天:",date("Y-m-d",time()),""; echo "今天:",date("Y-m-d",strtotime("18 june 2008")),""; echo "昨天:",date("Y-m-d",strtotime("-1 day")), ""; echo "明天:",date("Y-m-d",strtotime("+1 day")), "";

php實現數字轉換成中文大小寫代碼

//chinese_money.PHP //Changing Arab Money Num to Chinese Money Num /* Functions List: Chinese_Money_Max() 小數點前 此函數可以單獨拿出用於將阿拉伯數字轉為中文數字(大小寫可選,預設為大寫) 僅限整數(正負皆可) Chinese_Money_Min() 處理小數點後 Chinese_Money()by bbs.it-home.org*/ function

PHP強制顯示出錯資訊的實現方法

error_reporting(E_ALL);ini_set('display_errors', '1');//將出錯資訊輸出到一個文字檔ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); 複製代碼更多有關error_reporting的內容,請參考:php中error_reporting()函數的用法參考教你開啟PHP的error_log日誌的方法php

php 讀取目錄資料夾清單的例子

/*** 讀取目錄列表的函數* edit: bbs.it-home.org*/function GetFolders( $resourceType, $currentFolder ){ // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ; // Array that will hold the

PHP+Ajax即時自動檢測是否連網的實現代碼

PHP+Ajax即時自動檢測是否連網-bbs.it-home.org PHP+Ajax即時自動檢測是否連網 當前網路狀態: 複製代碼2,php代碼 //檢測網路連接,是否已連網public function getNetLink(){ header("cache-control:no-cache,must-revalidate"); header("Content-Type:text/html;charset=utf-8");

php登入函數代碼 php實現簡單登入函數的例子

/*** php登入函數* edit: bbs.it-home.org*/// 為php和mysql剔除不安全html代碼。function safestrip($string){ $string = strip_tags($string); $string = mysql_real_escape_string($string); return $string;} //登入資訊顯示函數function messages() { $message = ''; if($_SESSION[

php IP擷取城市API(純真IP資料庫)

/*** 根據IP地址取得城市名稱 純真IP資料庫* edit: bbs.it-home.org*/ function convertip($ip) { //IP資料檔案路徑 $dat_path = 'QQWry.Dat'; //檢查IP地址 if(!filter_var($ip, FILTER_VALIDATE_IP)) { return 'IP Address Error'; } //開啟IP資料檔案 if(!$fd =

Php刪除指定檔案與檔案夾的方法

//刪除指定目錄(檔案夾)中的所有檔案函數 function delfile($dir) { if (is_dir($dir)) { $dh=opendir($dir);//開啟目錄 //列出目錄中的所有檔案並去掉 . 和 .. while (false !== ( $file = readdir ($dh))) { if($file!="." && $file!="..") {

php 讀取檔案夾與檔案夾中檔案的函數

/*** 讀取檔案夾及其中檔案的函數* edit: bbs.it-home.org**/function GetFoldersAndFiles( $resourceType, $currentFolder ){ // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ; //

PHP遍曆檔案和檔案夾的小例子

/*** 遍曆檔案與檔案夾* edit: bbs.it-home.org* 2013/10/12*/ function list_dir($dirpath){ //判斷路徑最後面的字元是否是反斜線,如果沒有就加上一個 if($dirpath[strlen($dirpath)-1] !='\\'){ $dirpath.='\\';} //申明一個靜態變數數組,這樣每次遞迴調用該數組的值還會存在 static $result_array = array()

群發站內訊息的程式設計原理分析

php_user_info--------------------uid username password使用者的id 使用者名稱 密碼--------------------複製代碼2,儲存發給使用者的資訊的表。例如: php_user_message-------------------------------------------id uid mid ifShow

php漢字轉拼音的實現代碼

/*** * Pinyin.php * Example : Pinyin('張洪華',1); //第二個參數隨意設定則為utf-8編碼 為空白預設是gb編碼 * edit: bbs.it-home.org**/ function Pinyin($_String, $_Code='gb2312') { $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|

php遍曆檔案夾並實現編輯與刪除的代碼

/* 遍曆檔案夾; 功能:(a)可刪除檔案 (b)可編輯文本,網頁檔案 (c)可刪除檔案夾,前提是該檔案夾為空白 (d)可建立檔案,檔案夾,修改檔案夾名稱; */ $path=$DOCUMENT_ROOT; $path=str_replace("/","\\",$path); //指定檔案夾 $path=$path."\\"; if($_GET['folder']) { $path.=$_GET['folder']."\\"; } //本頁面路徑,下面傳回時將用到; $url=$_SERVER[

php資料庫連接、查詢、顯示結果的小例子

/*** php操作資料庫(串連、查詢、顯示結果)* edit: bbs.it-home.org*/define ('HOSTNAME', 'localhost'); //資料庫主機名稱define ('USERNAME', 'username'); //資料庫使用者名稱define ('PASSWORD', 'password'); //資料庫使用者登入密碼define ('DATABASE_NAME', 'testdb'); //需要查詢的資料庫$db =

php數學函數的簡單範例程式碼

php數學函數的小例子-bbs.it-home.orgecho abs(-1);//取絕對值函數echo "########ceil、floor函數######";echo ceil(1);//取大於參數的最小整數echo ceil(-1.1);echo "";echo floor(1.1);//取小於參數的最大整數echo floor(-1.1);echo "########max函數######";echo max(1,2);//取1和2的最大值echo "";$arr=array(1,2,

總頁數: 5203 1 .... 1611 1612 1613 1614 1615 .... 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.