what directory should I put this script in
I use a hosting server. I would like to simply open some t开发者_JS百科ext files with PHP and write some of the data into my server's database. This is unrelated to any front-end/user activity. I have never done this before and I am not sure where is the optimal location on the server... I see directories at top level such as PHP is that it?
I should also add that I do not understand how to execute a PHP script in a non-HTML form context
please advise on that as well sorry if this is stupid.
what directory should I put this script in? I would like to simply open some text files with PHP and write some of the data into my local database
I usually have a bin
directory in my project directory (next to webroot
).
I see directories at top level such as PHP is that it?
I can't see any reason to have a top level PHP directory in the first place.
I should also add that I do not understand how to execute a PHP script in a non-HTML form context
Assuming it has a shebang line, you just run it:
~/projects/myProject/bin/myScript.php
or (and not needing the shebang):
php ~/projects/myProjects/bin/myScript.php
精彩评论