Categories
Programming/php

[PHP] php 由 pipe (stdin) 讀進檔案 再做處理, 類似 C 的 pipe line 方法

$cnt = 0; $fp = fopen(‘php://stdin’,’r’); while ($line = stream_get_line($fp, 65535, “\n”)) { echo “LINE #” . (++$cnt) . “: ” . $line . “\n”; }

Categories
Programming/php

[memo] php.ini , short_open_tag

php 程式檔案開頭使用 <? 簡寫 須在 php.ini 設定 short_open_tag = On

Categories
Copy_N_Paste Programming/php

[PHP] Native SQLRELAY connect / query sample code

Categories
Programming/php Service System/Linux/Unix*

webhd.monster.tw : Use docker , nextcloud (a dropbox like web storage opensource) …. and docker startup commands …

URL: https://webhd.monster.tw/

Categories
Programming/php Software

[memo] 在 PHP 使用 ssh tunnel 連接遠端的 mysql server

 

Categories
Programming/php System/Linux/Unix*

PECL PHP REDIS client library phpredis

URL : https://github.com/phpredis/phpredis#classes-and-methods redis.ini file in /etc/php5/conf.d with the following contents: extension=redis.so

Categories
DATABASE Programming/php

[PHP] Sample code : Berkeley DB , bdb , dba_open , db4 , key-value database ,

$id = dba_open(“bdb4_tsid.db”, “w”, “db4”); if (!$id) { echo “dba_open failed\n”; exit; } dba_replace(“key”, “This is an example!”, $id); if (dba_exists(“key”, $id)) { echo dba_fetch(“key”, $id); dba_delete(“key”, $id); } dba_close($id);       This is an example! exist: This is an example! —> This is an example!

Categories
Programming/php

PHP Regex Validation of Hexadecimal Values / check hex number

preg_match( ‘/^[A-F0-9]{15,18}/’,$v)  

Categories
Programming/php

PHP 的 mktime , time format , 週編號 , week number of year, weeks starting on Monday

  1419696000 52 – 2014-12-29 00:00:00 52 – 2014-12-30 00:00:00 52 – 2014-12-31 00:00:00 00 – 2015-01-01 00:00:00 00 – 2015-01-02 00:00:00 00 – 2015-01-03 00:00:00 00 – 2015-01-04 00:00:00 01 – 2015-01-05 00:00:00 01 – 2015-01-06 00:00:00 01 – 2015-01-07 00:00:00

Categories
Copy_N_Paste Programming/php

Protected: PHP exception handling : using try catch exception syntax sample code

There is no excerpt because this is a protected post.