是否可以在没有PHP的情况下与MySQL数据库进行交互 [英] Is it possible to interact with a MySQL database without PHP

查看:82
本文介绍了是否可以在没有PHP的情况下与MySQL数据库进行交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题所述,是否可以与使用XAMPP创建的MySQL数据库进行交互(因此,使用PhpMyAdmin)而不使用PHP,而仅使用Javascript/JQuery?

这只是一个理论问题,我不想知道如何做(但如果您知道,我想放弃您的帮助).

有了这个,我并不是说要使用Ajax将我的请求发送到一个.php页面,然后该页面将与数据库进行交互,而是直接进行交互而不通过PHP.

解决方案

就PHP应用程序而言,不可能通过JavaScript与MySQL进行交互,因为JavaScript是在客户端执行的,即在浏览器中,它无权访问可以访问服务器上要提供服务的任何内容.

但是,使用 nodejs -基于 node-mysql 模块,这意味着您可以使用JavaScript代码与MySQL数据库进行交互. /p>

存在一些Web应用程序框架来帮助您启动和运行诸如 Express 之类的东西,这减轻了您的负担编写诸如路由逻辑之类的东西.

As the question says, is it possible to interact with a MySQL database created with XAMPP (so, using PhpMyAdmin) without using PHP, but only Javascript/JQuery?

This is a merely theoretical question, I don't want to know how to (but if you know it, I want discard your help).

With this, I don't mean using Ajax to send my request to a .php page that will then interact with the database, but directly interacting without passing through PHP.

解决方案

In terms of a PHP application, it's not possible to interact with MySQL through JavaScript because JavaScript is executed client side i.e in the browser, it doesn't have access to anything on the server it is being served from.

However, with nodejs - a JavaScript runtime built on Chrome's V8 JavaScript engine - you can write a complete JavaScript server side application without having to touch PHP. There's a node-mysql module which means you can interact with a MySQL database with JavaScript code.

Several web application frameworks exist to help you get something up and running like Express, which saves you the burden of having to write up things like routing logic.

这篇关于是否可以在没有PHP的情况下与MySQL数据库进行交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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