
Originally Posted by
DrByte
There isn't any special function or variable for that as far as I recall.
But if the file is in the same or nearby directory structure, you could explore using relative paths with ../.. etc.
However, your post raises a question, and understanding context would help:
WHY are you requiring another file from within a class? Perhaps it's better to put your other desired file code into a class of its own and then simply refer to the class?
drByte, thanks for the input. it seems:
PHP Code:
$path_info = pathinfo(__FILE__)['dirname'];
works.
as far as why... whole other can of worms...
using api wrappers for some of the heavy lifting on common carrier codes rather than hand coding seems to make much more sense to me. and it is actually not within the class, but extending the class prior to the class declaration. ie:
PHP Code:
<?php
$path_info = pathinfo(__FILE__)['dirname'];
if (!file_exists($sdk_loader = $path_info . '/prose/vendor/autoload.php')) {
return false;
}
require $sdk_loader;
require_once $path_info . '/prose/shipping.php';
class ups extends shipping
{
does that make sense?
Bookmarks