请问下,在put_file函数中的路径file_path参数,是输入绝对路径还是相对路径,如果绝对路径,Windows和linux平台的路径也有所不同。
PHP中文网2017-04-17 17:17:21
Indicates that the level of questioning needs to be improved
Is the put_file you are talking about the function here?
The internal call is os.stat, which can be a relative path or an absolute path.
You don’t need to care about the beginning of the absolute path. There are related functions that can help you operate, such as:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
You can also write your own function judgment, or set environment variables, etc.