开发者

PHP include chain not working

Here's the folder structure of my project:

/ping

--/Controller
----Ping_Conntroller_Main.php
----Ping_Conntroller_Db.php

--/Model
----dbCredentials.php

--/View
----output.html.php

'ping' is the folder that contains my project and it sits inside the 'xampp/htdocs/' directory on my computer (C:/xampplite/htdocs/)

Here is the initial code for each file:

OUTPUT.HTML.PHP
---------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

include($root.'/ping/Controller/Ping_Controller_Main.php');

PING_CONTROLLER_DB.PHP
----------------------
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

require($root.'/ping/Model/dbCredentials.php');

class Ping_Controller_Db
{

PING_CONTROLLER_MAIN.PHP
--------开发者_Python百科----------------
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

require($root.'/ping/Controller/Ping_Controller_Db.php');

class Ping_Controller_Main
{

These are the errors I get when trying to access the 'output.html.php' file in a browser:

Warning: include(C:/xampplite/htdocs/ping/Controller/Ping_Controller_Main.php) [function.include]: failed to open stream: No such file or directory in C:\xampplite\htdocs\ping\View\output.html.php on line 6

Warning: include() [function.include]: Failed opening 'C:/xampplite/htdocs/ping/Controller/Ping_Controller_Main.php' for inclusion (include_path='.;C:\xampplite\php\PEAR') in C:\xampplite\htdocs\ping\View\output.html.php on line 6

I know I must be doing something really stupid, but I've been staring at the error for the past 20mins and can't seem to get this to work.

Thanks in advance!


----Ping_Conntroller_Main.php
----Ping_Conntroller_Db.php

Filenames contain double "n" (CoNNtroller).


Do the two n's in the names of the actual files (as shown in your folder structure) have anything to do with it?


Looks like your files are named "Conntroller" instead of "Controller". If this isn't the problem, you might try using backslashes instead of forward slashes to separate the directories/filenames. I'm not sure if it makes a difference for PHP on Windows, but I know it generally makes a difference on Windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜