1
각 줄 사이에 줄 바꿈이 표시되도록하려고했지만 문자열에 다소 복잡한 출력이 포함되어있는 것 같습니다. "$ matches [ 'id']"추가 할 수 없습니다. 어디서나 일반적인 \ n \ r 줄. 나는 수많은 방법을 시도했다. 어떤 제안? 바보 것에 대해File_Put_Contents에 줄 바꿈을 추가하지 않았습니다.
<?php
$file = file_get_contents('page.htm');
// -------- PROFILEs --------
preg_match_all('#<a.*?href="(?:http://)www.site.com/profiles/(?P<id>\d+)[^>]+#msi',$file, $matches);
$profiles = $matches['id'];
$uprofiles = array_unique($profiles);
echo '<pre>',print_r($uprofiles),'</pre>';
file_put_contents('Profile.txt', $uprofiles);
// ---------- IDs ----------
preg_match_all('#<a.*?href="(?:http://)www.site.com/id/(?P<id2>\w+)[^>]+#msi',$file, $matches2);
$ids = $matches2['id2'];
$uids = array_unique($ids);
echo '<pre>',print_r($uids),'</pre>';
file_put_contents('ID.txt', $uids);
?>
죄송 간단해야, 분명히 나는이 시도 뭔가를
'$ uprofiles. = "\ n"; file_put_contents ('Profile.txt', $ uprofiles);를 시도 했습니까? –
전에 없었던 지금은했다. 그래도 좋은 생각처럼 보였다. – SuperMar1o