简体   繁体   中英

How can I write object oriented Javascript without using a framework?

抱歉,我仍在尝试自学Javascript,我想知道是否有人知道用与PHP类良好交互的类编写面向对象Javascript的最佳方法。

Javascript is already object oriented, in regards to classes there are many ways in which to achieve "templates". Since you are new to Javascript have a good read of any material from Douglas Crockford especially his book The Good Parts as he will enlighten you to the the true nature of Javascsript.

This leads me to the second part of your question, as to interacting well with PHP, my advice (from experience) is to have a good clear data serialization/deserialization layer from which you interact, JSON will help you immensely. Don't try and be clever, Javascript is a very different language to PHP. Work with the language not against it.

Happy coding :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM