Category Archives: PHP

[PHP] Output debug information to console

echo “<script>console.log( ‘Debug Objects: ” . $data . “‘ );</script>”; Ref. stackoverflow: How can I write to console in PHP?

Posted in PHP | Leave a comment

OBS – Get Active Publish Streaming

然後再使用php進行parse去除不必要的資訊

Posted in OBS, PHP, XML | Leave a comment

Eclipse 安裝 PHP 模組

環境:Eclipse Version: Luna Service Release 1 (4.4.1) 開啟Eclipse => Help => Install New Software Work with 選擇 Luna – http://download.eclipse.org/releases/luna 展開 Web, XML, Java EE and OSGi Enterprise Development 勾選PHP Development Tools (PDT) => Next => 安裝 安裝完畢後重新啟動即可

Posted in Eclipse, PHP | Leave a comment

Sublime Text 2 install PHP-Beautifier

環境:Windows 7 x64 安裝 PHP 1.1 http://windows.php.net/download/,選擇Installer最新版本下載安裝 1.2 將PHP安裝路徑加至Windows系統環境變數Path內 安裝php pear 2.1 下載http://pear.php.net/go-pear.phar至PHP目錄下 2.2 使用命令提示字元(以系統管理者啟動),切換至PHP目錄,輸入php go-pear.phar進行安裝 2.3 PHP目錄下會產生Pear_ENV.reg檔案,將它加入至系統內 PHP安裝PHP_Beautifier 3.1 在PHP目錄下,輸入pear install PHP_Beautifier-0.1.15進行安裝 3.2 修改PHP目錄下的php_beautifier,將error_reporting(E^ALL)修改為error_reporting(0),大約在第55行 3.3 修改PHP目錄下的php_beautifier.bat,將所有的改為/ 3.4 修改PHPpearPHPBeautifierFilter目錄下的Pear.filter.php及phpBB.filter.php,將require_once (‘PEAR/Config.php’);註解 Sublime Text 2安裝PHP_beautifier 4.1 Sublime Text 2安裝Package Control,進入Console模式(ctrl+`),輸入import urllib2,os; pf=’Package … Continue reading

Posted in PHP, Sublime Text 2 | Leave a comment

Post 檔案至Web CGI

第一種方式,linux curl command

第二種方式,PHP cUrl

Posted in PHP | Leave a comment

PHP 下拉檔案選單

Posted in PHP | Leave a comment

PHP強迫輸出

Source: http://php.net/manual/en/function.ob-flush.php some problems with ob_flush() and flush() could be resolved by defining content type header : header( ‘Content-type: text/html; charset=utf-8’ ); so working code looks like this:

Posted in PHP | Leave a comment

PHP Eclipse Editor

怒了, 還是來裝一下Editor好了 不然vim打得好累…… 參考蛙齋的作法1、蛙齋的作法2 先到官網下載Eclipse軟體安裝後,利用help=>install new software找到『Web, XML, Java EE and OSGi Enterprise Development』項目 在此項目下就可以看到php的相關plugin 然後再安裝rse,主要是可以讓eclipse支援remote操作(ftp、ssh等) rse主要在General Purpose Tools下,需要安裝『Remote System Explorer End-User Runtime、Remote System Explorer User Actions』這兩個 安裝完後便可以利用『Remote System Explorer』設定ssh的連線資訊 設定完成後選擇遠端的網頁目錄按右鍵『Create Remote Project』 這時候便可以用php explorer來瀏覽、編輯網頁 註:我比較懶,且不算是生產線上的系統,所以選擇直接編輯 通常最適當做法應該是在本機創模擬環境,確認ok後再上傳

Posted in PHP | Leave a comment

查詢關鍵字是否存在於以逗號分隔的資料欄位中

這樣有個好處 table的欄位可以開少一點 只是拉出來時如果要個別拆開 就需要程式語言有支援了…. (還有php有支援XD) 只是這邊有一點要小心,逗號前後的空格都有可能會影響比對的部分

Posted in MySQL, PHP | Leave a comment

檢查欄位是否已存在

使用 query 語法新增欄位時,通常要記得先檢查欄位是否已存在才比較妥當 而語法如下

Posted in MySQL, PHP | Leave a comment