簡體   English   中英

PHP從行號獲取字符串

[英]PHP get string from line number

我正在使用php獲取網頁內容:

$fileContent = file_get_contents('http://insertwebsitenamehere.com');

有沒有辦法尋找行號並在該位置退回行?

我知道您可以使用SplFileObject :: Seek如果fileContent是一個file 是否可以執行類似的操作而無需將其轉換為文件?

您要用file()代替

$fileContent = file('http://insertwebsitenamehere.com');
echo $fileContent[39]; //line 40

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM