开发者

preg_replace works from command line but not from browser?

开发者 https://www.devze.com 2023-02-12 08:01 出处:网络
I have a sql file which has the comments inside it. /* IMP : Only use C-Style comments only Every ID field should have this convention \"tableName_id\" ,

I have a sql file which has the comments inside it.

/*
IMP : Only use C-Style comments only

Every ID field should have this convention "tableName_id" , 
where tableName is the name of table, whom this id refers

*/

/*
It stores the system wide information 
we need at the time of updates or debugging.
*/
CREATE  TABLE IF NOT EXISTS `#__payplans_support` (
  `support_id` INT NOT NULL AUTO_INCREMENT,
  `key`           VARCHAR(45) NOT NULL ,
  `value`         TEXT NULL,
  PRIMARY KEY (`support_id`) ,
  UNIQUE INDEX `idx_key` (`key` ASC) 
)
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8 ; 


CREATE  TABLE IF NOT EXISTS `#__payplans_config` (  
  `config_id`   INT NOT NULL AUTO_INCREMENT,
/*name of tab*/
  `title`       VARCHAR(255) NOT NULL,
  `key`     VARCHAR(255) NOT NULL,
  `config`      TEXT NULL ,
  `componentname` VARCHAR(255) NULL,
/* xml and default ini path */
  `path` TEXT NULL,
  PRIMARY KEY (`config_id`) ,
  INDEX `idx_key` (`key` ASC)
)
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8 ;

The code below filters the comment from above sql.

$sql = file_get_content(from above file);
$var =  preg_replace("!/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/!s","",$sql); // EDIT

PROBLEM :

It is working perfectly in Linux (Command Line and from browser).

But It in not working on windows from Browser, but working with Windows command line the browser shows The connection was reset.开发者_如何转开发..

Please give me any solution.


I didn't get any correct solution here. So I just removed the comments from sql file.

0

精彩评论

暂无评论...
验证码 换一张
取 消