我正在使用preg_match_all
,试图匹配:
[<? or <?php]
[any amount of space here, at least one, may be newline]
[legendcool]
[any amount of space]
[(] return whatever is in here [)]
[any amount of space]
[?>]
到目前为止我有这个:
索引.php
$the_prophecy = file_get_contents("secret.php");
preg_match_all('~[<?|<?php]\s*[legendcool(](.*?)[)]\s*[?>]~',$the_prophecy,$matches) ;
秘密.php
<title>Regex Match all characters between two strings - Stack Overflow</title>
<link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
<?php legendcool({'',''}) ?>
<link rel="apple-touch-icon image_src" href="http://cdn.sstatic.net/stackoverflow/img/
例如,在 secret.php 中,我想得到{'',''}
你们有谁知道我可以如何调整自己preg_match_all
的工作方式吗?