我的代码:
<?php
$pass = "12345";
//checkPass($pass, $user, $length);
$file = file_get_contents("common.txt");
$array = explode("\n", $file);
if(in_array($pass, $array) == true) {
echo "it's in the array";
}
?>
Run Code Online (Sandbox Code Playgroud)
数组的前几行(我使用print_r($ array)...):
Array ( [0] => 12345 [1] => abc123 [2] => password [3] => computer [4] => 123456 [5] => tigger [6] => 1234 [7] => a1b2c3 [8] => qwerty [9] => 123 [10] => xxx [11] => money [12] => test [13] => carmen [14] => mickey [15] => secret [16] …
这是我的目录结构:
-根
--docs
--- doc1.php
--includes
---的header.php
--- footer.php
--- css.css
--index.php
在我的标题中,我链接到我的CSS文件,如下所示:
<link href="includes/styling.css" type="text/css" rel="stylesheet" />
Run Code Online (Sandbox Code Playgroud)
这适用于index.php,因为它是正确的路径(root/includes/css.css).
但是对于doc1.php来说,这不是正确的道路.(根/文档/包括/ css.css).
如何在保留一个包含该行代码的header.php文件的同时修复此问题?有没有办法强制路径在根目录中启动?