12

このエラーが発生し続けます:

警告: preg_match() [function.preg-match]: D:\xampp\htdocs\administrator\components\com_smms\functions\plugin.php 行 235 の不明な修飾子 't'

の上:

$PageContent = preg_replace($result->module_pregmatch, '', $PageContent);

$result->module_pregmatch で var_dump を実行すると、次の結果が得られます。

string '/<title>(.*)</title>/Ui' (length=23)

string '/<meta[^>]*name=["|\']description["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=77)

string '/<meta[^>]*name=["|\']keywords["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=74)

string '/<meta[^>]*name=["|\']author["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=72)

string '/<meta[^>]*name=["|\']copyright["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=75)

string '/<meta[^>]*name=["|\']robots["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=72)

string '/<meta[^>]*http=equiv=["|\']content-language["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=88)
string '/<meta[^>]*http-equiv=["|\']content-type["|\'][^>]*content=["|\'](.*)["|\']\s*\/>/Ui' (length=84)

string '/<link[^>]*href=["|\'](.*)["|\'][^>]*rel=["|\']shortcut[^>]*icon["|\'][^>]*type=["|\']image\/x-icon["|\']\s*\/>/Ui' (length=114)

string '/<link[^>]*href=["|\'](.*)["|\'][^>]*rel=["|\']alternate["|\'][^>]*type=["|\']application\/rss\+xml["|\'][^>]*title=["|\'](.*)["|\'][^>]\/>/Ui' (length=142)

string '/<link[^>]*href=["|\'](.*)["|\'][^>]*rel=["|\']alternate["|\'][^>]*type=["|\']application\/atom\+xml["|\'][^>]*title=["|\'](.*)["|\'][^>]\/>/Ui' (length=143)

誰かが私が間違っていることを教えてもらえますか? 私はあまりにも長い間このエラーに悩まされてきました...

4

1 に答える 1

39

正規表現パターンの区切り記号としてスラッシュを使用しているため、機能し/<title>(.*)</title>/Ui'ません (</title>スラッシュがあります)。

スラッシュをエスケープするか、パターンに含まれていない別の区切り文字を使用できる必要があります。たとえば、

'/<title>(.*)<\/title>/Ui' //(esacaping)

また

'~<title>(.*)</title>~Ui' //different delimiter
于 2009-06-22T10:08:32.083 に答える