更新時間:2022-02-16 09:39:51 來源:動力節點 瀏覽1286次
從任何網站獲取他的 html 源代碼都很容易。您可以通過 php.ini 的功能非常輕松地做到這一點。我會告訴你 3 種 獲取 html 源代碼的方法。
解決方案1:
<?php
$data = file_get_contents("https://www.lipsum.com/");
$html_sourcecode_get = htmlentities($data);
echo $html_sourcecode_get;
?>
解決方案2:
<?php
$data = file_get_contents('https://www.lipsum.com/');
echo htmlspecialchars($data);
?>
解決方案3:
<?php
$u = "https://www.lipsum.com/";
$ch = curl_init($u);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$newquery = curl_exec($ch);
echo $newquery_get = htmlentities($newquery);
?>
0基礎 0學費 15天面授
有基礎 直達就業
業余時間 高薪轉行
工作1~3年,加薪神器
工作3~5年,晉升架構
提交申請后,顧問老師會電話與您溝通安排學習