Home > Backend Development > PHP Tutorial > javascript - Is there any function in php that can get the full path of a file based on the file name? Or how to get the full path of the file in js?

javascript - Is there any function in php that can get the full path of a file based on the file name? Or how to get the full path of the file in js?

WBOY
Release: 2016-08-08 09:06:59
Original
891 people have browsed it

For example:

<code>根据:demo.txt
获取他的全路径:C:/Users/ilovemosh/Desktop/demo.txt 
</code>
Copy after login
Copy after login

Reply content:

For example:

<code>根据:demo.txt
获取他的全路径:C:/Users/ilovemosh/Desktop/demo.txt 
</code>
Copy after login
Copy after login

Your file must be in include_path. It is impossible for you to give you an absolute path just by giving a file name. . Not so awesome

Portal

dirname(__FILE__)
Get the absolute path of the file

The folder where the currently executing PHP file is located __DIR__, and then determine the file path based on the relative relationship between demo.txt and the currently executing PHP file

Generally, to obtain file information, you must first use a certain method (such as uploading) before you can obtain its file information


The plupload plug-in of js allows you to upload this file (but it does not necessarily have to be successfully uploaded to where, you just get the file object for calculation) and then obtain the information of this file. The upload in the yii framework of php is also Can get the full path information of the file

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template