[英]How can I write text to an external file using JQuery/JavaScript/PHP?
I have some text stored in a POST variable that I need to append to an HTML file. 我在POST变量中存储了一些文本,需要将它们附加到HTML文件中。 I want to do within my PHP webpage, but it could use HTML, JQuery, Javascript, or anything else that will run natively.
我想在我的PHP网页中进行操作,但是它可以使用HTML,JQuery,Javascript或将在本机运行的任何其他方式。 I've tried the PHP approach, but it hasn't worked despite my numerous attempts.
我已经尝试过PHP方法,但是尽管我进行了无数次尝试,但该方法仍然无效。 Always a 500 internal server error.
始终是500个内部服务器错误。 And I can't find anything on writing to files using JQuery, so if anyone out there knows something I don't, it would be appreciated.
而且我在使用JQuery写入文件时找不到任何东西,因此,如果那里有人知道我不知道的内容,将不胜感激。 Thanks :)
谢谢 :)
Writing directly to you html/php documents is extremely bad practice. 直接向您编写html / php文档是非常糟糕的做法。 As your comment said you need to validate the input and if you make a mistake you could screw up your whole website.
正如您的评论所说,您需要验证输入内容,如果输入有误,则可能会破坏整个网站。
There are a couple of options you could use: 您可以使用几个选项:
I think that with the DB you`ll manage, just be safe and build in some security 我认为使用DB,您将可以安全,安全地建立管理
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.