John Davidson

PHP can't find path while HTML can

0 comments
Message:


I'm still a bit new to PHP and stumbled across a weird error I can't fix.
I have different util PHP files for different purposes, such as getting user data or basic util functions.


But I can't figure out why PHP does sometimes not find the path when using the require function.

In particular this example:


print '<a href="/api/connection.php">Huh</a>';

ob_start();
require "/api/connection.php";
ob_end_clean();

HTML shows a working link redirecting to the page, but PHP still can't find the connection file.


Here is my file tree:


So why is that and how can I fix it? Does PHP have another way of linking files or is it something else?


Thanks in Advance



My Answer:
be used for a variety of tasks, including creating dynamic websites, processing form data, interacting with databases, generating PDFs, and more. It is a versatile programming language that is commonly used for web development.

Rate this post

5 of 5 based on 6364 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us