Generate Windows .lnk file with PHP

人盡茶涼 提交于 2019-12-10 10:11:34

问题


I'm working on a project which involves an FTP server running ProFTPd and a PHP/MySQL backend that creates accounts for users.

Upon the creation of accounts, users are sent e-mails with their account details and instructions for downloading FileZilla or CyberDuck, depending on their OS, detected via user-agent string.

To make things easier for novices, I thought of having .lnk files generated for FileZilla with the account logins details as parameters, so they would just have to click on the .lnk files to open up the server. This is not a crucial feature but more of a technical challenge.

My questions are :

  • is this even feasible ? are there any alternatives (eg. generating a .bat with a script pointing to the Filezilla executable ?)
  • are there any issues, perhaps with relative / absolute paths pointing to the executable ?
  • to go even further, what would be the simplest way of providing users with software with FTP access on a single account / single server (web interface is not an option).

回答1:


It's very difficult to create .lnk files programmatically. See this answer.

In FileZilla, I think the best you can do reliably is to pass along a filezilla.xml file, and describe the steps necessary to import it after FileZilla has been installed.




回答2:


I don't see any way that you can do this while making it easier for novice users. If you create a shortcut file, you'd have to know the path of the install. Good luck getting that from a user who you assume would have a hard time using a username/password in an FTP program. Even if you got that, you'd be generating the shortcut file after you receive input from the user, then you'd have to email the file to the user or have them download it -> delay.

I would advise against this. Having worked with clueless users before, any attempt to make things "easier" for them but requiring them to do something else usually backfires immensely. Save yourself the headache, and provide a very well-written how-to instead.



来源:https://stackoverflow.com/questions/2999256/generate-windows-lnk-file-with-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!