【问题标题】:How to get the exact directory of a script如何获取脚本的确切目录
【发布时间】:2017-05-15 10:51:23
【问题描述】:

说我跑步

http://mymaindomain.com/helloworld/somescript.php

我想要http://mymaindomain.com/helloworld/

我该怎么做?

【问题讨论】:

标签: php


【解决方案1】:

请检查一下我的回答好吗?

https://stackoverflow.com/a/41407858/3821823

你也可以像这样定义 const 变量:

const BASE_URL = 'http://mymaindomain.com/helloworld/';
// or
define('BASE_URL', 'http://mymaindomain.com/helloworld/');

echo BASE_URL;

【讨论】:

    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 2010-09-08
    • 1970-01-01
    相关资源
    最近更新 更多