目前日期文章:201402 (14)

瀏覽方式: 標題列表 簡短摘要
$content = "";
$fp = fopen("", "rb");

if (!$fp)
die("Error opening file.");
while (!feof($fp))
$content .= fread($fp, 2048);

$fp=fopen("", "w");
fwrite($fp, $content);

Felix 發表在 痞客邦 留言(0) 人氣()

首先要講下 at 命令 是要用 /bin/bash shell 來執行的,
你可以在php裡查一下 apache 使用的是哪個 shell,

$output = shell_exec('echo $SHELL');

Felix 發表在 痞客邦 留言(0) 人氣()


Felix 發表在 痞客邦 留言(0) 人氣()

function test(obj){


function test(objID){
  var obj = document.getElementById(objID);

Felix 發表在 痞客邦 留言(0) 人氣()

function httpGet(theUrl){var xmlHttp =null;

    xmlHttp =newXMLHttpRequest();"GET", theUrl,false);
    xmlHttp.send(null);return xmlHttp.responseText;}

Felix 發表在 痞客邦 留言(0) 人氣()


This is because images and tmp_file_upload are only writable by root user. For upload to work we need to make the owner of those folders same as httpd process owner OR make them globally writable (bad practice).

  1. Check apache process owner:  ps aux | grep httpd. The first column will be the owner typically it will be nobody
  2. Change the owner of images and tmp_file_upload to be become nobody or whatever the owner you found in step 1.

    $sudo chown nobody /var/www/html/mysite/images/

Felix 發表在 痞客邦 留言(0) 人氣()


可以對 input 功能變數使用不同的 name 來上傳多個檔案。

PHP 支援同時上傳多個檔案並將它們的訊息自動以陣列的形式組織。要完成這項功能,需要在 HTML 表單中對檔案上傳功能變數使用和多選框與復選框相同的陣列式送出語法。

注: 對多檔案上傳的支援是在 PHP 3.0.10 版本增加的。

Felix 發表在 痞客邦 留言(0) 人氣()



 <IMG id ="2XSHZ" >
<script language="javascript" >
 var i = Math.random(); 

Felix 發表在 痞客邦 留言(0) 人氣()

  【實作 Server 端

所謂 Server-Sent Event 中文解釋為伺服器推送或伺服器推播,主要是用來將伺服器上的資料自動傳輸至 Client 端,使用的是 HTTP 通訊協定。首先需要 Server 端的應用程式,筆者以 ASP.NET 泛型處理常式來實作本文 Server 端的應用程式,您也可以利用 PHP、JSP 等其他 Server 端的程式語言來實作。

Felix 發表在 痞客邦 留言(0) 人氣()


Felix 發表在 痞客邦 留言(0) 人氣()


function trim_dom_node($string){
$string=str_replace(" <","<",$string,$count);

Felix 發表在 痞客邦 留言(0) 人氣()



echo "<

Felix 發表在 痞客邦 留言(0) 人氣()

In the early days of PHP programming, PHP code was limited to being procedural in nature. Procedural codeis characterized by the use of procedures for the building blocks of the application. Procedures offer a certain level of reuse by allowing procedures to be called by other procedures.

However, without object-oriented language constructs, a programmer can still introduce OO characteristics into PHP code. It's a tad more difficult and can make the code more difficult to read because it's mixing paradigms (procedural language with pseudo-OO design). OO constructs in PHP code — such as the ability to define and use classes, the ability to build relationships between classes that use inheritance, and the ability to define interfaces — make it much easier to build code that adheres to good OO practices.

While purely procedural designs without much modularity run just fine, the advantages of OO design show up in the maintenance. Because a typical application will spend the bulk of its lifetime in maintenance, code maintenance is a large expense over the lifetime of an application. It can also be easily forgotten during development. If you're in a race to get your application developed and deployed, long-term maintainability can take a back seat to getting something to work.

Felix 發表在 痞客邦 留言(0) 人氣()

<?php function foo() {
$numargs = func_num_args(); if ($numargs > 2) {
echo "First: ". func_get_arg(0). "\n";
echo "Second: ". func_get_arg(1). "\n";
echo "Third: ". func_get_arg(2). "\n";
} return $numargs;
$n = foo (10, 15, 20); //傳入 3 個參數 echo $n; ?>

Felix 發表在 痞客邦 留言(0) 人氣()