我在可能不是什么大问题的事情上遇到了这样的困难。
我不断收到错误消息:警告:require(models/match.php)[function.require]:无法打开流:没有这样的文件或目录。
现在我知道它确实可以在同一文件级别的同一目录中工作,但当我将它与其他代码位一起放入时,它已经工作了
代码:
<?php
define('KICKOFF_REL','../../../../');
set_include_path(KICKOFF_REL);
require 'models/match.php';
$league_id = 1; //'premier league';
require 'models/league.php';
$theMenuLeagueObj = new league();
$league_details = $theMenuLeagueObj->fetch_league($league_id);
//require 'models/match.php';
$theMatchObj = new match(); //Create match object
$allAvaliableMatches = $theMatchObj->fetch_all_active_matches($league_details['league_name']);
echo '<table border="1">';
echo '<tr>';
echo '<th scope="col">'. $league_details['league_name'] . '</th>';
echo '<th scope="col">'. $league_details['league_name'] . '</th>';
echo '</tr>';
foreach($allAvaliableMatches as $thematch){
echo '<tr>
<td>'. $thematch['home_team'] . " v " . $thematch['away_team'] . '</td>
<td>Sunday Games</td></tr>';
}
echo '</table>';