Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getBaseUrl() {
- // output: /myproject/index.php
- $currentPath = $_SERVER['PHP_SELF'];
- // output: Array ( [dirname] => /myproject [basename] => index.php [extension] => php [filename] => index )
- $pathInfo = pathinfo($currentPath);
- // output: localhost
- $hostName = $_SERVER['HTTP_HOST'];
- // output: http://
- $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://';
- // return: http://localhost/myproject/
- return $protocol.$hostName.$pathInfo['dirname']."/";
- }
- $base = getBaseUrl();
- require_once $base.'_include/db/qry.php';
- require_once $base.'_include/db/functions.php';
- Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:xampphtdocsmysite_includeheader.php on line 9
- Warning: require_once(http://localhost/mysite/_include/db/qry.php): failed to open stream: no suitable wrapper could be found in C:xampphtdocsmysite_includeheader.php on line 9
- Fatal error: require_once(): Failed opening required 'http://localhost/mysite/_include/db/qry.php' (include_path='.;C:xamppphpPEAR') in C:xampphtdocsmysite_includeheader.php on line 9
- // just example, change to fit your real path.
- $base = __DIR__ . '/../';
- require_once $base.'_include/db/qry.php';
- require_once $base.'_include/db/functions.php';
Add Comment
Please, Sign In to add comment