가능한 경우 알아 내려고 시도 중 & 사용할 코드 : 현재 페이지의 내용을로드하고 w/in의 특정 페이지 (c.html)에 대한 상대 경로를 표시합니다. 지금까지 사용하여 PHP 또는 PHP Simple Html DOM Parser.PHP가 현재 페이지의 특정 내용을 얻으려면 PHP
내 코드의 "를 #navbar"
<?php
$pg = 'c.html';
include_once '%resource(simple_html_dom.php)%';
/* $cpath = $_SERVER['REQUEST_URI']; Old version */ // Path to current pg from root
$cpath = "http://www.".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
echo var_dump($cpath).": Current Root Path"."<br />"; // "http://www.partiproductions.com/copyr/index.php" - Correct
$cfile = basename($cpath);
echo 'Current File: ' . $cfile . "<br />"; // "index.php" - Current pg, Correct
$html = file_get_html($cpath); // Getting Warning: URL file-access is disabled in the server configuration & failed to open stream: no suitable wrapper could be found in.. & Fatal error: Call to a member function find() on a non-object in...
foreach($html->find(sprintf('#navbar a[href=%s]', $pg)) as $path) {
echo 'Path: ' . $path."<br />";
}
?>
'print_r ($ _ SERVER)'를 실행하고 사용할 수있는 값이 있는지 확인하십시오. – Landon
'$ html = file_get_html ('index.php');를 시도하고 아무것도 얻었는지 확인하십시오. 그렇지 않다면 스크립트와 같은 디렉토리에'index.php'가 있습니까? 그렇지 않다면'$ cpath'를 얻으십시오. – cpilko
안녕하세요 @cpilko 그냥 index.php했지만, 작동하지 않았다. index.php는 현재 페이지입니다. Wally에게 아래의 코멘트를보십시오 – parti