最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - can a programming language be both client and server side? - Stack Overflow

programmeradmin1浏览0评论

What I mean is basically for example PHP, PHP can be used both to output data onto the client/browser and to connect/query databases.

Would it then be both a client side and a server side programming language?

Or is it still a server-side language as it's main use is database querying

Javascript too, js can be used as a client side language which is what it is but it can also be used to establish a connection to a database, does that then make it both a server and client side programming language?

thanks.

What I mean is basically for example PHP, PHP can be used both to output data onto the client/browser and to connect/query databases.

Would it then be both a client side and a server side programming language?

Or is it still a server-side language as it's main use is database querying

Javascript too, js can be used as a client side language which is what it is but it can also be used to establish a connection to a database, does that then make it both a server and client side programming language?

thanks.

Share Improve this question asked Dec 17, 2015 at 14:20 SebastianZdroanaSebastianZdroana 2093 silver badges11 bronze badges 1
  • Have a look at this question on Programmers SE for further reading on the differences between client-side and server-side technologies – ImClarky Commented Dec 17, 2015 at 14:34
Add a ment  | 

4 Answers 4

Reset to default 5

PHP's technically a "client" of your MySQL server, but "client side" in web development refers to code that runs on your user's web browser. PHP is an exclusively server-side technology (barring oddities like PHP-GTK).

JavaScript is both client-side (in browser) and server-side (via Node).

What makes a programming language client-side (if we're talking about Web development) is that it's being executed in the Web browser.

JavaScript is both a client and server-side language because it can be used to develop client application in your browser (or even mobile apps using environments like Apache Cordova) and also as backend technology thanks to runtimes like NodeJS which is entirely executed in a server machine.

PHP is a server-side-only language(1), and the fact that PHP scripts can act as clients of other server environments or technologies doesn't mean that it's a client-side language.

The client-side term refers to another physical layer away from the server which usually has a graphical user interface.

(1) Actually it's true that PHP can be used to develop other kinds of application like desktop apps, BTW, its main usage is server-side Web development.

Javascript can be used as both front end and back end programming language. For example AngularJS is used for front end and NodeJS is used for backend. NodeJS runs on server and AngularJS runs on browser.

PHP is server side programming language. PHP runs on server, not in web browser. PHP can output data to browser but it actually runs on server. PHP is "Hypertext Preprocessor". PHP engine process PHP code and returns final HTML code.

Client/server-side is not some property of language, but merely a place where you use it in each specific case.

Even in web development while JavaScript dominates client-side domain for historical reasons, there's no technical reasons that would stop you from using any other language inside browser using scripting hosts on Window - look up PerlScript, for example - or implementing JS-based translator/interpreter/piler.

发布评论

评论列表(0)

  1. 暂无评论