Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のような XML ファイルがあります。
... <MyElement>Introduction:<br /> ... </MyElement> ...
「はじめに:」と</br>その要素の残りを返す方法はありますか?
</br>
PHP と SimpleXML を使用しています。単純echo $document->MyElementに「Introduction:...」を使用して、Introduction 行とコンテンツを混同します。
echo $document->MyElement
xml 文字列を読み取るには、次のコードを使用し、root_elementルート要素名に合わせて変更します。
root_element
$content = simplexml_load_string($xml_string); echo $content->root_element->MyElement