分类:
2009-12-30 18:08:50
require_once('./Gather_Func.php'); //包括了Mysql类,dump函数
require_once('./mail.php'); //用来给商户发邮件
$gather=new Gather();
$gather->start();
return;
final class Gather{
private $log_file; //日志文件名
private $db; //数据库对象
private $setting; //全局设置
private $debug=false; //是否调试
/**
* 构造方法,生成需要的变量
*/
function __construct(){
if(!file_exists("./log")){mkdir("./log");} //建立日志目录
if(!file_exists("./log/Gather")){mkdir("./log/Gather");} //建立日志目录
$this->log_file='./log/Gather/'.date('Ymd_His').'.txt'; //生成日志文件名
//数据采集的定期运行程序
//得到数据库连接参数
$DSN=include("../APP/Config/DSN.php");
//生成数据库访问对象
$this->db=new Mysql($DSN['dbDSN']);
$this->setting=array(); //全局变量 ,记录所有RMT网站的设置
$this->getRMTSetting(); //取得设置
$this->setUnRunning(); //所有采集程序未运行
//dump($this->setting);exit;
}
/**
* 开始采集
*
*/
function start(){
// while(1){
// if($this->getGlobal()) //如果已经更新,重新取得设置
// $this->UpdateSetting();
// $this->checkRMTs();
// $this->debug('status',_T::sleeping);
// sleep(10);//休息60秒
// }
//$this->debug('setting',dump($this->setting,'setting',true));
//$this->Run(28);
foreach($this->setting as $key=>$value)
if(is_numeric($key))
$this->Run($key);
}
//运行采集,参数是setting数组的下标
function Run($key){
$rmt=$this->setting[$key];
//需要设置已经运行状态,保存最后运行时间,数据库中记录,生成子进程,保存子进程ID
$this->setting[$key]['running']=true;
$lasttime=time();
$this->setting[$key]['lasttime']=$lasttime;
$sql='insert into `rmt_gather_log`(`rmt_ID`,`gather_time`)values("'.$rmt['rmt_ID'].'","'.$lasttime.'")';
$this->db->Query($sql);
$gl_ID=$this->db->InsertID();
$plugin=$rmt['plugin'];
$this->debug('status', _T::preparePlugin.":$key:$plugin");
//临时取消多进程
// $fork_id=pcntl_fork();
// if($fork_id==-1){
// die("Can't fork.");
// }elseif($fork_id){ //父进程
// $this->setting[$key]['fork_id']=$fork_id;
// return;
// }
//
//子进程
//$cmd="start php ".$plugin." -- $gl_ID";
//exec($cmd);
include_once($plugin);
$class=$rmt['plugin_class'];
$obj=new $class();
$obj->set($gl_ID,'Win',$this->db); //指定操作系统
$this->debug('status',_T::runClass.":$class");
$obj->getData();
$alldata=$obj->ending();
if($alldata===false)return;
$alldata['rmt']=$rmt;
//$this->debug('alldata',dump($alldata,'alldata',true));
$this->saveData($alldata,$gl_ID);
//saveName($alldata);
}
//取得全局变量
function getGlobal(){
$sql='select `value` from `rmt_setting` where `name`="rmt_gather_setting_updated"';
$ret=strtolower($this->db->Single($sql));
return ($ret==1||$ret=='yes'||$ret=='true'||$ret=='on');
}
//将全局变量置0,表示采集程序已经取得最新设置
function resetGlobal(){
$sql='update `rmt_setting` set `value`=0 where `name`="rmt_gather_setting_updated"';
$this->db->Query($sql);
}
/**
* 从数据库中取出采集设定
* 保存到全局变量$this->setting中
*/
function getRMTSetting(){
/**
* 取得RMT信息,包括
* rmt_ID RMT编码
* name RMT网站名称
* URL 网站地址
* plugin 插件文件名
* plugin_class 插件类名
* enabled 是否允许采集
* gather_type 采集类型:固定时间间隔或者是固定时间
* gather_interval_start 固定时间间隔的开始时间
* gather_interval_interval 固定时间间隔的间隔时间
* gather_time_type 固定时间的类型
* company_ID 对应的商户ID
*/
$sql='select * from `rmt_rmt` where `enabled`=1 ';
$this->setting=$this->db->Table($sql);
//exec("php -q Gather_www.gamemoney.cc.php");
//exec("php -q Gather_rmt.diamond-gil.jp.php");
//循环每一允许采集的RMT网站,取出其详细采集设置
foreach($this->setting as $key=>$rmt)
if(is_numeric($key))
{
/*采集设置有两种,根据字段rmt.gather_type
* ui_rg_interval 定期
* rmt.gather_interval_start 开始时间点
* rmt.gather_interval_interval 间隔分钟数
* ui_rg_time 定时
* rmt.gather_time_type 定时种类
* ui_rg_everyday 每天采集
* rmt_gather.time_point 时:分
* ui_rg_everyweek 每周采集
* rmt_gather.time_point 天 时:分
*/
$id=$rmt['rmt_ID'];
if($rmt['gather_type']=='ui_rg_time'){ //定时采集,取出每一个时间点
$sql='select * from `rmt_rmt_gather` where `rmt_ID`='.$id.' order by `time_point`';
$points=$this->db->Table($sql);
$this->setting[$key]['points']=$points;
}
/**取得所有RMT的最后采集记录
* gather_time 采集时间
* pages 搜索页数
* seconds 花费秒数
*/
$sql="select count(*) from `rmt_gather_log` where `rmt_ID`=$id";
$count=$this->db->Single($sql);
if($count>0){
$sql="select gather_time from `rmt_gather_log` where `rmt_ID`=$id order by gather_time desc LIMIT 0,1";
$lasttime=$this->db->Single($sql);
}else{
$lasttime='';
}
$this->setting[$key]['lasttime']=$lasttime;
}
//取得所有游戏的基准RMT站点
$sql="select * from rmt_game";
$table=$this->db->table($sql);
$base_rmt=array();
foreach($table as $row){
$base_rmt[$row['game_ID']]=$row['base_rmt_ID'];
}
$this->setting['base']=$base_rmt;
//取得全局过滤参数
$filter=array();
$filter['Buy']=array();
$filter['Sell']=array();
$sql="select value from rmt_setting where name='rmt_buy_ul'";
$filter['Buy']['Top']=$this->db->Single($sql);
$sql="select value from rmt_setting where name='rmt_buy_dl'";
$filter['Buy']['Bottom']=$this->db->Single($sql);
$sql="select value from rmt_setting where name='rmt_sell_ul'";
$filter['Sell']['Top']=$this->db->Single($sql);
$sql="select value from rmt_setting where name='rmt_sell_dl'";
$filter['Sell']['Bottom']=$this->db->Single($sql);
$this->setting['filter']=$filter;
//取得每个RMT站点的修正参数
$modifyBuy=array();
$modifySell=array();
$sql="select * from rmt_rmt";
$table=$this->db->table($sql);
foreach($table as $row){
$modifyBuy[$row['rmt_ID']]=$row['modify_buy'];
$modifySell[$row['rmt_ID']]=$row['modify_sell'];
}
$this->setting['modify']=array();
$this->setting['modify']['Buy']=$modifyBuy;
$this->setting['modify']['Sell']=$modifySell;
//设置全局变量,说明已经取得最新设置
$this->resetGlobal();
}
/**
* 更新RMT设置
*
* @param array $this->setting 原始设置
* return array 新设置
*/
function UpdateSetting(){
$oldsetting=$this->setting;
$this->getRMTSetting();
//把原来Setting中的运行信息复制到新的
foreach($this->setting as $key=>$value){
if(isset($oldsetting[$key])){
$this->setting['running']=$oldsetting['running'];
}else{
$this->setting['running']=false;
}
}
}
//设置所有RMT未运行
function setUnRunning(){
foreach($this->setting as $key=>$value){
if(is_numeric($key))
$this->setting[$key]['running']=false;
}
}
//检查所有网站,决定是否采集
function checkRMTs(){
foreach($this->setting as $key=>$rmt)
if(is_numeric($key)){
$rmtID=$rmt['rmt_ID'];
$name=$rmt['name'];
$url=$rmt['URL'];
$plugin=$rmt['plugin'];
$type=$rmt['gather_type'];
$lasttime=$rmt['lasttime'];
if(!$lasttime){
$lasttime=strtotime('2007-01-01');
}
if($this->debug)$this->debug('debug',"check RMTs :key:$key,rmt:$rmt,rmtID:$rmtID,name:$name,url:$url,plugin:$plugin,type:$type,lasttime:".date('Y-m-d H:i:s',$lasttime));
if($rmt['running']){//运行中,需要检查是否已经停止
if($this->debug) $this->debug('debug', "in running");
if(!isset($rmt['fork_id'])){//没有子进程,更改状态为未运行,等待下次检查
$this->setting[$key]['running']=false;
if($this->debug)$this->debug('debug',"change to stop");
continue;
}
//有子进程,检查子进程状态
$fid=$rmt['fork_id'];
$status='';
$ret=pcntl_waitpid($fid,$status,WNOHANG |WUNTRACED );
if($ret==$fid){//返回的进程ID 与要检查的进程ID相同,表示进程已经结束
$this->setting[$key]['running']=false;
if($this->debug)$this->debug('debug',"thread is over");
continue;
}
if($ret==0){ //返回0,表示进程未结束
if($this->debug)$this->debug('debug', "thread is running");
continue;
}
$this->debug('thread',"\npcntl_waitpid($fid,,) returned:".$ret);
continue;
}
//未运行,需要检查是需要运行
if($this->debug)$this->debug('debug', "is not running");
//用include来包含
if($type=='ui_rg_interval'){//固定间隔
$start=$rmt['gather_interval_start'];
$interval=$rmt['gather_interval_interval'];
if(strtotime($start)>time()){ //还没到设定的开始运行时间
if($this->debug)$this->debug('debug', "start > now ");
continue;
}
if((time() - $lasttime )<60* $interval){ //当前时间-最后运行时间<间隔
if($this->debug)$this->debug('debug',"now-last);
continue;
}
if($this->debug)$this->debug('debug',"$type:start:$start,interver:$interval,time:".time().",lasttime:".$lasttime);
$this->Run($key);
continue;
}
//固定时间运行
$type=$rmt['gather_time_type'];
if($this->debug)$this->debug('debug',"ui_rg_time");
if(!$rmt['points']) continue; //未设置时间点
if($this->debug)$this->debug('debug',"point is set");
$d=getdate();//取得当前时间的部分
$now_wday=$d['wday'];//0表示周日
$now_hours=$d['hours'];
$now_minutes=$d['minutes'];
$d=getdate($lasttime);//取得最后一次运行的时间部分
$last_wday=$d['wday'];
$last_hours=$d['hours'];
$last_minutes=$d['minutes'];
if($this->debug)$this->debug('debug', "now:$now_wday $now_hours:$now_minutes");
if($this->debug)$this->debug('debug',"last:$last_wday $last_hours:$last_minutes");
foreach($rmt['points'] as $point){
$point=$point['time_point'];
if($type=='ui_rg_everyday'){//每天运行
list($set_hours,$set_minutes)=explode(':',$point);
if( $this->greater2($set_hours,$set_minutes,$last_hours,$last_minutes)&&
$this->greater2($now_hours,$now_minutes,$set_hours,$set_minutes)){
if($this->debug)$this->debug('debug', "every day");
if($this->debug)$this->debug('debug', "set point:$set_hours $set_minutes");
$this->Run($key);
}
}else{//每周运行
if($this->debug)$this->debug('debug', "every week");
list($set_wday,$set_hours,$setminutes)=split('[/.\s]',$point);
if($this->debug)$this->debug('debug',"set point:$set_wday $set_hours:$set_minutes");
if( $this->greater3($set_wday,$set_hours,$set_minutes,$last_wday,$last_hours,$last_minutes)&&
$this->greater3($now_wday,$now_hours,$now_minutes,$set_wday,$set_hours,$set_minutes)){
$this->Run($key);
}
}//每周运行处理结束
}//循环每一个采集时间点结束
}//循环每一个RMT网站结束
}//检查并采集方法结束
//比较第一个(时,分)是否大于第二个
function greater2($h1,$m1,$h2,$m2){
if($h1>$h2)return true;
if($h1<$h2)return false;
return $m1>$m2;
}
//比较第一个(天,时,分)是否大于第二个
function greater3($d1,$h1,$m1,$d2,$h2,$m2){
if($d1>$d2)return true;
if($d1<$d2)return false;
if($h1>$h2)return true;
if($h1<$h2)return false;
return $m1>$m2;
}
function saveName($games){
foreach($games as $game){
$gameName=$game['name'];
$areas=$game['area'];
$sql="select count(*) from `rmt_game` where `name`='$gameName'";
$count=$this->db->Single($sql);
if($count<1){
$sql="select count(*) from `rmt_game_alias` where `alias`='$gameName'";
$count=$this->db->Single($sql);
if($count<1){
$sql="insert into rmt_game(name)values('$gameName')";
$this->db->Query($sql);
$game_ID=$this->db->InsertID();
$this->debug('game not found',_T::gameNotFound.":$gameName");
}else{
$sql="select game_ID from rmt_game_alias where alias='$gameName'";
$game_ID=$this->db->Single($sql);
}
}else{
$sql="Select `game_ID` from `rmt_game` where `name`='$gameName'";
$game_ID=$this->db->Single($sql);
}
if(count($areas)>0)
foreach($areas as $areaName){
//查区域表
$sql="select count(*) from `rmt_area` where `name`='$areaName' and `game_ID`='$game_ID'";
if($this->db->Single($sql)>0) continue;
//查区域别名表
$sql="select count(*) from rmt_area_alias where alias='$areaName'";
if($this->db->Single($sql)>0)continue;
$this->debug('area not found',_T::areaNotFound.":$gameName:$areaName");
$sql="insert into rmt_area(game_ID,name)values($game_ID,'$areaName')";
$this->db->Query($sql);
}
}
}
/**
* 保存采集到的数据,入口参数是一个数组
* Buy ,
* Sell: {
* $gameName=>{
* $areaName=>{
* 'detailURL'=>$detailURL,
* 'areaName'=>$areaName,
* 'basePrice'=>$basePrice,
* 'stock'=>$stock,
* 'favor'=>{
* $stock=>$price,
* ......other favor price
* }
* },
* ......other area
* },
* ......other game
* }
*
* Status:
* {
* {
* 'code'=>$code,
* 'content'=>$content
* },
* ......other status
* }
* @param unknown_type $all
*/
function saveData($all,$gl_ID){
//查看是否有这个RMT网站,如果有,得到rmt_ID
$RMT_name=$all['rmt']['name'];
$rmt_ID=$all['rmt']['rmt_ID'];
if(isset($all['Buy']))
$Buy=$all['Buy'];
else
$Buy=null;
if(isset($all['Sell']))
$Sell=$all['Sell'];
else
$Sell=null;
$sellCount=0;
if($Buy)
foreach($Buy as $gameName=>$areas){
$ret=$this->saveGame($gameName,$areas,'Buy',$rmt_ID,$gl_ID);
if($ret)$sellCount+=$ret;
}//处理所有购买价格
if($Sell)
foreach($Sell as $gameName=>$areas){
$ret=$this->saveGame($gameName,$areas,'Sell',$rmt_ID,$gl_ID);
if($ret)$sellCount+=$ret;
}
if($sellCount&&$all['rmt']['user_ID']){
//将库存的减少量加到商户的人气点击上
$sql='update rmt_companypro set clicks=clicks+'.$sellCount.' where user_ID='.$all['rmt']['user_ID'];
$this->db->Query($sql);
}
//dump($all);dump($sellCount);exit;
//记录运行信息
$timeStart=$all['timeStart'];
$readPages=$all['readPages'];
//根据Status要发消息和邮件
$status=$all['Status'];
$this->debug('dump',dump($status,'',true));
$company=$all['rmt']['user_ID'];
if(count($status)>0){ //有消息要发送
$title=_T::gatherError.":".$RMT_name.":".date('Y-m-d H:i');
$content='';
foreach($status as $s){
$content.="\n" ;
$content.=$s['code'];
$content.=$s['content'];
$content.="\n";
$content.="\n";
}
$c("'","`",$content);
$params=$rmt_ID;
{//发送消息
$this->sendMsg('ui_message_type_deny_gather',$title,$content,0,1,$params);
if($company>0){//发消息给商户
$this->sendMsg('ui_message_type_deny_gather',$title,$content,1,$company,$params);
//取商户的email
$sql="select email from rmt_users where user_ID=$company";
$to=$this->db->Single($sql);
//发送邮件
gatherMail($title,$content,$to);
}
}
}
$timeEnd=time();
$elapse=$timeEnd - $timeStart;
$sql="update rmt_gather_log set pages=$readPages,seconds=$elapse where gl_ID=$gl_ID";
$this->db->Query($sql);
}
function sendMsg($type,$title,$content,$from,$to,$params){
$sql="insert into rmt_message(type,title,content,user_ID,params,created)values(";
$sql.="'$type','$title','$content',$from,'$params',".time().")";
$this->db->Query($sql);
$id=$this->db->InsertID();
$sql="insert into rmt_message_user(user_ID,message_ID,`read`,reply,created)values(";
$sql.="$to,$id,0,0,".time().")";
$this->db->Query($sql);
}
function saveGame($gameName,$areas,$direction,$rmt_ID,$gl_ID){
$sellCount=0;//本游戏的出货量
//根据游戏名查找游戏ID
$gameName=strtolower(trim($gameName));
$sql="select count(*) from `rmt_game` where lower(trim(`name`))='$gameName'";
$count=$this->db->Single($sql);
if($count<1){
$sql="select count(*) from `rmt_game_alias` where lower(trim(`alias`))='$gameName'";
$count=$this->db->Single($sql);
if($count<1){
$this->sendMsg(
'ui_message_type_gather_new_game',
_T::new_game_title,
_T::new_game.$gameName.".
\n",
0,1,$rmt_ID
);
$this->debug('game not found',_T::gameNotFound.":$gameName");
//$sql="insert into rmt_game(name)values('$gameName')";
//$this->db->Query($sql);
//$game_ID=$this->db->InsertID();
return 0;
}else{
$sql="select game_ID from rmt_game_alias where lower(trim(alias))='$gameName'";
$game_ID=$this->db->Single($sql);
}
}else{
$sql="Select `game_ID` from `rmt_game` where lower(trim(`name`))='$gameName'";
$game_ID=$this->db->Single($sql);
}
if(count($areas)>0){
foreach($areas as $areaName=>$area){
$area_ID=$this->getAreaID($game_ID,$areaName,$gameName);
if($area_ID===false)continue;
$basePrice=$area['basePrice'];
if($basePrice<=0)continue;
$stock=$area['stock'];
if(isset($area['favor']))
$favors=$area['favor'];
else
$favors=null;
//此处需要过滤和修正
{/*
$filterTop=$this->setting['filter'][$direction]['Top'];
$filterBottom=$this->setting['filter'][$direction]['Bottom'];
if(strpos($filterTop,'%')||strpos($filterBottom,'%')){
//取出基准价格
$refPrice=0;
if(isset($this->setting['base'][$game_ID]))
if($this->setting['base'][$game_ID]){
$refRMT=$this->setting['base'][$game_ID];
$sql="select price from rmt_gather_data where game_ID=$game_ID and area_ID=$area_ID and isLast=1 and rmt_ID=$refRMT and direction='$direction'";
if($this->db->Rows($sql)>0){
$refPrice=$this->db->Single($sql);
if(strpos($filterTop,'%')){
$filterTop=$this->getMiddle($filterTop,null,'%');
$filterTop=$refPrice*$filterTop/100;
}
if(strpos($filterBottom,'%')){
$filterBottom=getMiddle($filterBottom,null,'%');
$filterBottom=$refPrice*$filterBottom/100;
}
if($filterTop) if($basePrice>$filterTop)continue;
if($filterBottom) if($basePrice<$filterBottom)continue;
}//找到了基准站的价格
}//设置了基准站
}else{
if($filterTop) if($basePrice>$filterTop)continue;
if($filterBottom) if($basePrice<$filterBottom)continue;
}
*/}//过滤处理完成
//以前的数据成为旧数据
$sql="select count(*) from rmt_gather_data where game_ID=$game_ID and area_ID=$area_ID and rmt_ID=$rmt_ID and Direction='$direction' and isLast=1";
$count=$this->db->Single($sql);
if($count>0){
//取最后一次的库存
$sql="Select stock from rmt_gather_data where game_ID=$game_ID and area_ID=$area_ID and rmt_ID=$rmt_ID and Direction='$direction' and isLast=1";
$lastStock=$this->db->Single($sql);
$sql="Select gd_ID from rmt_gather_data where game_ID=$game_ID and area_ID=$area_ID and rmt_ID=$rmt_ID and Direction='$direction' and isLast=1";
$gd_IDs=$this->db->table($sql);
foreach($gd_IDs as $gd_ID){
$gd_ID=$gd_ID['gd_ID'];
$sql="update rmt_gather_data_favor set isLast=0 where gd_ID=$gd_ID";
$this->db->Query($sql);
}
$sql="update rmt_gather_data set isLast=0 where game_ID=$game_ID and area_ID=$area_ID and rmt_ID=$rmt_ID and Direction='$direction' and isLast=1";
}else
$lastStock=0;
//修正
{
$modify=$this->setting['modify'][$direction][$rmt_ID];
if($modify){
$basePrice=$basePrice*$modify/100;
foreach($favors as $fCount=>$fPrice)
$favors[$fCount]=$fPrice*$modify/100;
}
}
if($lastStock&&$stock<$lastStock){
$sellCount+=($lastStock - $stock);
}
$this->db->Query($sql);
//插入数据库一条数据
if($basePrice&&$stock) {
$sql="insert into `rmt_gather_data`(`game_ID`,`area_ID`,`rmt_ID`,`Direction`,`price`,`stock`,`created`,`gl_ID`,isLast) ".
"values('$game_ID','$area_ID','$rmt_ID','$direction','$basePrice','$stock',".time().",$gl_ID,1)";
$this->db->Query($sql);
$gd_ID=$this->db->InsertID();
//处理优惠价
if($favors)if(count($favors)>0)
foreach($favors as $fCount=>$fPrice)if($fPrice>0){
$sql="insert into rmt_gather_data_favor(gd_ID,price,count)values($gd_ID,$fPrice,$fCount)";
$this->db->Query($sql);
}//写入所有优惠价
}
}//处理所有区域
}
return $sellCount;
}
//根据区域名查找区域,如果没有这个区域,插入
function getAreaID($game_ID,$areaName,$gameName){
//查区域表
$areaName=strtolower(trim($areaName));
$sql="select count(*) from `rmt_area` where lower(trim(`name`))='$areaName' and `game_ID`='$game_ID'";
if($this->db->Single($sql)>0){
$sql="select area_ID from rmt_area where lower(trim(`name`))='$areaName' and game_ID='$game_ID'";
return $this->db->Single($sql);
}
//查区域别名表
$sql="select count(*) from rmt_area_alias where lower(trim(alias))='$areaName'";
if($this->db->Single($sql)>0){
$sql="select area_ID from rmt_area_alias where lower(trim(alias))='$areaName'";
return $this->db->Single($sql);
}
$this->sendMsg(
'ui_message_type_new_area',
_T::new_area_title,
_T::new_area.$gameName.':'.$areaName,
0,1,$game_ID
);
$this->debug('area not found',_T::areaNotFound.":".$gameName.":".$areaName);
//$sql="insert into rmt_area(game_ID,name)values($game_ID,'$areaName')";
//$this->db->Query($sql);
//return $this->db->InsertID();
return false;
}
function debug($name,$content){
$str=date('Y-m-d H:i:s')."\t";
$str.=$name."\t";
$str.=$content."\n";
echo $str;
file_put_contents($this->log_file,$str,FILE_APPEND);
}
/**
* 获取字符串中指定开头和结尾中间的内容(不包括开头和结尾标识),不区分大小写
*
* @param 要处理的字符串 $str
* @param 开头标识 $begin(如果空,则从字符串开头开始)
* @param 结尾标识 $end(如果空,则到字符串结尾)
*
* @return 返回中间的字符串,或者是错误代码
*/
protected final function getMiddle($str,$begin=null,$end=null,$enableN){
if($begin!==null){
$begin=strtolower($begin);
$i=strpos($str,$begin);
if($i===false){
if($enableNone)return '';
$this->status(array(
'code'=>_T::GC_EXPLODE_NO_BEGIN,
'content'=>"$begin \n$str \n"
));
return false;
}
$str=substr($str,$i+strlen($begin));
if($str===false){
if($enableNone)return '';
$this->status(array(
'code'=>_T::GC_EXPLODE_NO_MIDDLE,
'content'=>"$begin \n$end \n$str \n"
));
return false;
}
}
if($end!==null){
$end=strtolower($end);
$j=strpos($str,$end);
if($j===false){
if($enableNone)return $str;
$this->status(array(
'code'=>_T::GC_EXPLODE_NO_END,
'content'=>"$end \n$str "));
return false;
}
$str=substr($str,0,$j);
if($str===false){
if($enableNone)return '';
$this->status(array(
'code'=>_T::GC_EXPLODE_NO_MIDDLE,
'content'=>"$begin \n$end \n$str "));
return false;
}
}
return $str;
}
}
?>