我真的希望有人可以帮助我,因为我已经在4天内尝试了所有东西,而我只是被卡住了。我之前有一个问题没有得到解决。
当我点击我的一个按钮“注册”时,我收到以下错误:
Warning: include(resources/includes/header.html): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/website/php/global/registernumbers.php on line 5
Warning: include(): Failed opening 'resources/includes/header.html' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.6.2/lib/php') in /Applications/MAMP/htdocs/website/php/global/registernumbers.php on line 5
以下是相关代码:
header.html中:
<!-- 1 button in the header -->
<li>
<a href="php/global/registernumbers.php">Register 1</a> <!-- Error -->
</li>
<!-- registernumbers.php is called fine. I can see my <h1> and <h2> text -->
registernumbers.php:
<?php
if( !isset( $_SESSION ) ) session_start();
?>
<?php include 'resources/includes/header.html'; ?>
<h1>Register Numbers</h1>
<h2>global/registernumbers</h2>
我的文件夹结构如下所示:
../../php/resources/includes/header.html
Is working, but the CSS is ofcourse not called.
resources/includes/header.html
This is the correct path, but here I get the error
<?php include(ROOT_PATH . 'resources/includes/header.html'); ?>
Does not work either
标题的路径是正确的,我甚至试图安装MAMP。 当我使用它时:
当我将header.html
和registernumbers.php
放在index.php
所在的位置时,一切正常。
有人知道我能做些什么吗?我真的想把我的文件分成这样的文件夹。
回复后更新了代码
<?php
if( !isset( $_SESSION ) ) session_start();
?>
<?php define 'APP_ROOT', '/resources/includes/header.html'; ?>
<h1>Register Numbers</h1>
<h2>global/registernumbers</h2>
<?php define ('APP_ROOT', '/resources/includes/header.html'); ?>
// Here I do not get any errors, but the header is not called either
<?php define 'APP_ROOT', '/resources/includes/header.html'; ?>
//Parse error: syntax error, unexpected ''APP_ROOT'' (T_CONSTANT_ENCAPSED_STRING) in /Applications/MAMP/htdocs/website/php/global/registernumbers.php on line 5