读/写服务器端文件〜评论板(JQuery) [英] Read/Write Server side files ~ Comment Board (JQuery)

查看:126
本文介绍了读/写服务器端文件〜评论板(JQuery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找让客户端能够将文本发布到服务器端文件(.txt),然后将其保存到文本文件的最好和最简单的方法。我想建立一个简单的董事会发表评论。快速简单的方法?



我环顾四周,看起来有很多方法。我还没有找到简单的允许读/写的东西,而只使用JQuery功能。建议?

解决方案

jQuery是一个构建在javascript之上的框架。 Javascript是一种在浏览器中运行的语言。我们称浏览器为客户端。这就是为什么我们称JavaScript为客户端脚本的一种形式。要在服务器上读取/写入文件,您需要使用服务器端语言(如PHP)。 如果你这样做的话,你可以设置一个表单的action属性,或者一个链接的href方法到php scrip,或者使用AJAX来请求它,真的很容易。



如果您希望您的网站在访问某些网站时有任何优势,我认为您应该使用数据库进行评论而不是.txt文件。但是,对于那些没有太大改变的东西,比如博客帖子,你可以使用静态的HTML或txt文件,这样可以更快地提供数据库内容。


I am searching for the best and easiest way to have the client side be able to "post" text to a server side file (.txt) and then save it to the text file. I would like to set up a simple board to post comments. Something quick and easy?

I've looked around and it seems there are many ways out there. I haven't found something that simply allows read/write, while only utilizing JQuery functionality. Advice?

解决方案

jQuery is a framework built on top of javascript. Javascript is a language thet runs within the browser. We call the browser the 'client'. That's why we call javascript a form of client side scripting.

to read/write files on the server, you'll need to use a server side language such as PHP.

If you do so, you can either set the action attribute of a form, or the href method of a link to the php scrip, or request it using AJAX, which is really easy to do.

If you want your site to be any good when you get some visitors, I think you should use a database for comments instead of a .txt files. However, for something that doesn't change that much, such as blog posts, you can use static HTML or txt files, these are quicker to serve then database contents.

这篇关于读/写服务器端文件〜评论板(JQuery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆