<?php
$modcontent = file_get_contents('hello.xml');
preg_match("/<Content(.*?)>(.+?)<\/Content/s", $modcontent, $xmlmatches);
$search = array('<![CDATA[',']]>');
$replace = array('','');
$thenewone = str_replace($search, $replace, $xmlmatches[2]);
fopen('hello.xml');
fwrite($thenewone);
fclose('hello.xml');
?>
こんにちは、上記のコード (動作しません) から始めて、hello.xml ファイルを変更して、preg_match のように 間のコンテンツのみを保持するようにできますか? hello.xml はhttp://www.google.com/ig/modules/hello.xmlにあります。私の PHP と英語の知識はかなり低いので、別の言葉でもう一度説明します。hello.xml ファイルを開き、Content タグ間のコンテンツを読み取り、そのコンテンツを書き込み、ファイル内の他のすべてを置き換えて、hello.xml ファイルを保存できる PHP スクリプトが必要です。したがって、このすべての操作の後、.xml にはHello, world!のみが含まれている必要があります。. どうもありがとう!