PHPÈ¥³ý×¢ÊÍÀà
<?php
include_once("error.php");
/*
* Ãû³Æ : PHPÈ¥Ô´Âë×¢Êͼ°Çá¶ÈѹËõÊý¾Ý
* ×÷Õß : pjx
* °æ±¾ : v 2010/02/25 v 1.0
* ˵Ã÷ : ¸ÃÀàÓÃÓÚÇå³ýPHPÎļþ(ͬʱ¼æÈÝC/C++·ç¸ñ×¢Ê͵ÄÎļþ)Ô´ÂëµÄ×¢Êͼ°È¥³ý¶àÓà¿Õ¸ñ
* ʾÀý £º
* ʵÀý => $data = new REMOVE_COMMENT($file_path);
* ֻȥ³ý×¢ÊÍ => $data->remove(),·µ»ØÈ¥µô×¢ÊͺóµÄÊý¾Ý,ÎļþÅÅ°æºÍÔ´ÎļþÒ»Ñù
* È¥³ý×¢ÊͺͿոñ => $data->compact(),·µ»ØÈ¥³ý×¢ÊͺͿոñºóµÄÊý¾Ý
* £¨½«Á¬Ðø¶à¿Õ¸ñѹËõΪһ¸ö¿Õ¸ñ,·ÀÖ¹"var $val"Çé¿ö£©£¬ÎļþÈÝÒ×ÔĶÁ
* Çá¶ÈѹËõ => $data->compact_hightly(),·µ»ØÈ¥µôËùÓпհ××Ö·ûµÄÊý¾Ý,Îļþ»ù±¾ÎÞ·¨ÔĶÁ
* ±£´æÎļþ => $date->save($file_name),Èç²ÎÊý$file_name´æÔÚ,ÔòÎļþ±£´æΪ$file_name,
* Èô²»´æÔÚ,Ôò±£´æÔÚÏàͬµÄĿ¼ÏÂ,ÎļþÃûΪʱ¼ä·û´®
*
* bug : ×Ö·û´®Èç°üÀ¨¶à¿Õ¸ñºÍ"//",ÄÇô×Ö·û´®»á²¿·Ö»áɾ³ý, Õû¸öÎļþ½á¹¹¿ÉÄܻᱻÆÆ»µ
**/
class REMOVE_COMMENT{
var $path = "";
var $file = "";
var $content = "";
var $after_content = "";
var $compact_content = "";
var $reg_comment = "!((/\*)[\s\S]*?(\*/))|(//.*)!";
var $reg_space = "![ ]+!";
var $reg_all_space = "!\s+!";
var $file_info = array();
var $alowed_type = array("php","css","c","c++","txt","html","htm","tpl");
var $save_file = "";
function __construct($path="") {
$this->load_file($path);
}
function load_file($path=""){
global $error;
$this->free();
if(!$path){
$this->halt($error[0]);
&nbs
Ïà¹ØÎĵµ£º
ÒÔ¶¯ÊÖʵ¼ùΪÈÙ , ÒÔÖ»¿´²»Á·Îª³Ü;
ÒÔ´òÓ¡ÈÕ־ΪÈÙ , ÒÔµ¥²½¸ú×ÙΪ³Ü;
ÒÔ¿Õ¸ñËõ½øΪÈÙ , ÒÔÖƱíËõ½øΪ³Ü;
ÒÔµ¥Ôª²âÊÔΪÈÙ , ÒÔÈ˹¤²âÊÔΪ³Ü;
ÒÔÄ£¿é¸´ÓÃΪÈÙ , ÒÔ¸´ÖÆÕ³ÌùΪ³Ü;
ÒÔ¶à̬ӦÓÃΪÈÙ , ÒÔ·ÖÖ§ÅжÏΪ³Ü;
ÒÔPythonicΪÈÙ , ÒÔÈßÓàÍÏí³Îª³Ü;
ÒÔ×ܽá·ÖÏíΪÈÙ , ÒÔ¹òÇóÆä½âΪ³Ü; ......
$file1 = 'F:/46.gif';
$file2 = 'F:/test.txt';
$file3 = 'F:/47.gif';
$size = filesize($file1);
echo 'Îļþ´óСΪ£º'.$size;
echo "\n<br>ת»¯Îª¶þ½øÖÆ ...";
$content = file_get_contents($file1);
$content = bstr2bin($content);
$fp = fopen($file2, 'w');
fwrite($fp, $content);
fclose($fp);
......
Òª²»³öÏÖÂÒÂ룬¾ÍÒª±£³ÖÊý¾Ý¿âºÍÒ³ÃæµÄ±àÂë¸ñʽһÖÂ.ÎÒÈ«²¿Ê¹ÓÃutf-8µÄ±àÂë.
Ê×ÏÈÒ³Ãæ:
1. ½«ÎļþÓÃUE´ò¿ª,½«ÎļþÁí´æΪUTF-8ÎÞBOM¸ñʽ.ºÜ¶à±à¼Æ÷¶¼¿ÉÓÃ.
2.ʹÓà header("content-type:text/html;¡¡charset=utf-8"); Ç¿ÖÆת»»³Éutf-8µÄ±àÂë.
Ò²¿ÉÒÔн¨Ò»¸öhead.php,ÈçÏÂ,ÔÚÒ³ÃæÖÐÓÃinclude( ......
ËѼ¯²»È«£¬Á´½ÓûÓÐÈ«²¿²âÊÔ£¬´ó²¿·Ö¿ÉÓÃ
Easy Template System
http://ets.sourceforge.net/
http://ets.sourceforge.net/ets.pdf
http://prdownloads.sourceforge.net/ets/ets305b.zip?download
Smarty
http://smarty.php.net/
FastTemplate
http://www.thewebmasters.net/php/FastTemplate.phtml
http://www ......
˵µ½¼Æ»®ÈÎÎñ´ó¼Ò¿ÉÄܶ¼Ïëµ½ÓÃcrontabÀ´ÊµÏÖ¡£¿ÉÊDz¢²»ÊÇËùÓÐÈ˶¼ÊÇʹÓÃlinuxϵͳ£¬Ò²²»ÊÇËùÓÐÈ˶¼ÓжÀÁ¢·þÎñÆ÷¡£ÕâʱºòÈçºÎÓÃphpÀ´
ʵÏּƻ®ÈÎÎñÄØ¡£
º¯Êý- ignore_user_abort()
£¬
Õâ¸öº¯Êý¿ÉÒÔ°ïÖúÎÒÃÇʵÏÖÏñlinuxÖеÄcronÒ»ÑùʵÏּƻ®ÈÎÎñ£¬ÏÂÃæÒ»ÆðÀ´¿´Ï¸ÃÈçºÎÀ´ÊµÏÖ¡£
¸Ãº¯Êý°´ÕÕ×ÖÃæÒâ˼¾ÍÊÇ“ºöÂÔÓû§Ö ......