新闻文章:无需 PHP 即可写入服务器磁盘?
我现在正在研究一个小项目,我们需要一个非常非常基本的新闻文章系统。理想情况下,这是一个简单的 XML 文件,将写入一些新闻,然后进行解析以显示在主页上。当然,这个文件在服务器上。
我的问题是,如果服务器没有启用 PHP,如何允许客户端浏览器写入此 XML 文件?
我知道 TiddlyWiki 使用 .JAR 文件来允许写入,但是我还应该尝试其他方法吗?
I'm looking into a small project just now where we have a need for a very very basic news article system. Ideally, this is a simple XML file that will be written to with some news, and then parsed to display on the homepage. This file is on the server, of course.
My question is how to allow a client browser to write to this XML file, given that the server will not have PHP enabled?
I know of TiddlyWiki which uses a .JAR file to allow the writes, but are there any other methods I should try?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于 FTP 似乎已启用/支持,因此您最好的选择是创建一个完成这项工作的小程序。 FTP 连接可以相当简单地通过 Apache Commons Net 完成FTP客户端。您唯一的问题是,FTP 连接详细信息需要以某种方式嵌入到小程序中,并且任何不怀好意的人都可以从小程序的源代码中提取它,因为小程序被下载到客户端计算机中。
Since FTP seems to be enabled/supported, your best bet is to create an applet which does the job. FTP connectivity can fairly simple be done by Apache Commons Net FTPClient. Your only problem is that the FTP connection details needs to be embedded in the applet somehow and that anyone with bad intent can extract it from the applet's source code since applets are downloaded into the client machine.
如果没有一些服务器端代码,您将无法将文件写入服务器。
您需要一个“PHP/Java/FTP 服务器/其他”后端服务器进程来获取内容并将其写入文件。
Without some serverside code, you will not be able to write files to the server.
You need a "PHP/Java/FTP-Server/something else"-backend serverprocess to take the content and write it to a file.
Apache 支持 HTTP PUT 和 一些浏览器在XMLHttpRequest中支持它。只要您愿意将编辑器限制为支持它的浏览器,您就可以使用它,而无需在服务器上安装其他软件或在客户端上使用插件。
Apache supports HTTP PUT, and some browsers support it in XMLHttpRequest. So long as you are willing to limit editors to browsers that support it, you could use that without installing additional software on the server or using a plugin on the client.
FTP 肯定会起作用,具体取决于执行更新的用户对其的熟悉程度。
如果上传解决方案需要基于浏览器,您也许可以运行 FTP 小程序 并让用户记住连接详细信息/密码。
FTP would definitely work, depending on how well the user doing the updates is familiar with it.
If the upload solution needs to be browser-based, you could perhaps run an FTP applet and have the user remember the connection details/password.