Tan*_*ger 1 html php html-parsing
我需要从html文件中获取两件事:
<title>和之间的文字</title><body>和之间的文字</body>有人知道怎么做这个吗?这是我到目前为止:
$contents = file_get_contents($_GET['file']);
$title = preg_replace("/.*<title[^>]*>|<\/title>.*/si", "", $file);
$body = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $file);
Run Code Online (Sandbox Code Playgroud)
我需要在文本框中回显标题,在文本区域中回复正文.