用百度的翻译API,比如内容是这样的。
<p>file_get_contents 得到文件的内容,整个文件读入一个字符串中</p> <p>....</p> <pre>$homepage = file_get_contents('http://www.example.com/'); echo $homepage; </pre> <p>用fopen打开url, 以get方式获取内容(借助fgets()函数)</p>
文章里<p>标签和<pre>标签不定数量,如何只翻译<p>标签里的内容呢