I have the following code:
require("\create_form\view.php");
and receiving the following error:
Warning: require(\create_formiew.php) [function.require]: failed to open stream: Invalid argument in C:\xampp\htdocs\training\school\STU001_MAIN.php on line 67
You can see from the error message that "require(\create_formiew.php)" has a missing "\v", whereas I wrote "\create_form\view.php".
What's the problem?
Either escape the backslashes in double quotes, or just use forward slashes. Forward slashes work on Windows too.
Also you probably don't want to use an absolute path.
require("./create_form/view.php");
Or make it relative to the document root with:
require("$_SERVER[DOCUMENT_ROOT]/create_form/view.php");
// Note: Use without key quotes only in double quoted string context!
\v
is the escape sequence for a vertical tab.
Either use single quotes in your strings or escape the backslashes (\\
) to avoid ambiguities.
try using
require("/create_form/view.php");
You can use 'DIRECTORY_SEPARATOR' to avoid errors with system specific file paths.
Try using double (\) backslashes between directorys:
require("\create_form\view.php");