删除 php 文件
我不知道如何做到这一点,我有一个定义(并创建)数据库的文件,我希望它运行一次(在安装时),而不是每次运行 index.php 页面时,那么什么是您认为最好的方法是什么?我正在考虑当文件(db_define.php)成功运行时从index.php中删除该文件。
I'm not sure how to do this, I have a file which defines (and creates) the database, I want it to be run once (on installation) and not every time the index.php page is run, so what is the best way to do this do you think? I was thinking of deleting the file from index.php when the file (db_define.php) is run successfully.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,您会指示安装软件的人员在安装过程中手动运行此类脚本。
但是,如果您坚持自动完成此操作,那么检查数据库是否存在,或者它是否是正确的版本可能更聪明(根据您已经拥有的版本控制内容......您确实有一个数据库版本存储在数据库中,对吧?)并且在这种情况下不运行脚本。
Usually you would instruct the person installing the software to run such a script manually as part of the installation procedure.
However, if you insist on having this done automatically, it might be smarter to just check if the DB exists, or if it is the correct version (according to the versioning stuff that you already have in place... you do have a DB version stored in the DB, right?) and not run the script in that case.