문자열에서 주석구문을 제거하는 PHP 정규식
페이지 정보
작성자 관리자 (61.♡.26.29) 작성일 17-06-13 23:16 조회 3,969 댓글 0본문
/* */주석
[code]
<?php
$str = preg_replace('/\/\*(.*?)\*\//is', '', $str);
?>
[/code]
<!-- -->주석
[code]
<?php
$str = preg_replace('/<!--(.*?)-->/is', '', $str);
?>
[/code]
//주석
[code]
<?php
$str = preg_replace('/\/\/(.*)\n', '', $str);
?>
[/code]
#주석
[code]
<?php
$str = preg_replace('/#(.*)\n/', '', $str);
?>
[/code]
'주석
[code]
<?php
$str = preg_replace('/'(.*)\n/', '', $str);
?>
[/code]
* 출처 : http://openlife.tistory.com/378
[code]
<?php
$str = preg_replace('/\/\*(.*?)\*\//is', '', $str);
?>
[/code]
<!-- -->주석
[code]
<?php
$str = preg_replace('/<!--(.*?)-->/is', '', $str);
?>
[/code]
//주석
[code]
<?php
$str = preg_replace('/\/\/(.*)\n', '', $str);
?>
[/code]
#주석
[code]
<?php
$str = preg_replace('/#(.*)\n/', '', $str);
?>
[/code]
'주석
[code]
<?php
$str = preg_replace('/'(.*)\n/', '', $str);
?>
[/code]
* 출처 : http://openlife.tistory.com/378
추천0
댓글목록 0
등록된 댓글이 없습니다.