javascript 卡死_有JavaScript杀死PHP

javascript 卡死

Spoiler alert, the short answer is absolutely not. In this article, I will explain how they thrive together and how you can use that to your advantage to be a better programmer.

剧透警报,简短的回答绝对不是。 在本文中,我将解释它们如何共同发展以及如何利用这一优势来成为更好的程序员。

First of all, PHP has been around for a long time, so much so, that most of the internet is built on PHP. Even if no new apps were created with PHP, it would still be around for decades to come.

首先,PHP已经存在了很长时间,以至于大部分Internet都建立在PHP之上。 即使没有使用PHP创建新的应用程序,它仍将存在数十年。

Secondly, there are a few things that PHP and python for that matter are good at that Javascript just can’t do. A prime example is the live loading of new code. Take a modular PHP application like WordPress for example, you can upload a new module, click activate and there it is, done. Javascript just can’t do that. You have to first shut down the application, add the new code, then rebuild the application, and finally deploy it.

其次,在某些方面,PHP和python擅长Javascript无法做到的事情。 一个典型的例子是实时加载新代码。 以像WordPress这样的模块化PHP应用程序为例,您可以上传一个新模块,单击“激活”,然后就完成了。 Javascript不能做到这一点。 您必须首先关闭应用程序,添加新代码,然后重新构建应用程序,最后部署它。

Of course, Javascript libraries and frameworks have become king in the UI realm. You only have to look at the most popular PHP framework, Laravel, which has fully embraced VueJS to allow a better UI experience. Even if you're not using Laravel, it’s very easy to Augment any PHP application with Vue or React.

当然,JavaScript库和框架已成为UI领域的王者。 您只需要查看最受欢迎PHP框架Laravel,该框架已完全包含VueJS以提供更好的UI体验。 即使您不使用Laravel,使用Vue或React扩展任何PHP应用程序也非常容易。

When frontend javascript libraries and frameworks like React and Vue were first released, there was an obvious limitation with front end rendering for SEO, so much so that google had to changed how it crawled web pages, so as not to completely disqualify Single Page Applications. Server-Side Rendering (SSR) quickly became a thing to get around this problem. Today it is still best practice to employ SSR if SEO is important to you.

当前端javascript库和框架(如React和Vue)首次发布时,SEO的前端呈现存在明显的局限性,以至于google必须更改其对网页的爬网方式,以免完全取消Single Page Applications的资格。 服务器端渲染(SSR)很快成为解决此问题的方法。 今天,如果SEO对您很重要,则仍然是采用SSR的最佳实践。

Since SSR is such an important capability, which is exactly what PHP does, and PHP can do some really cool capabilities that Javascript doesn’t have you can see there is no killer blow. The two can and should coexist for a long time to come.

由于SSR是一项非常重要的功能,而这正是PHP的功能,PHP可以执行Javascript所没有的一些非常酷的功能,因此您不会看到致命的打击。 两者可以并且应该长期共存。

A lot of questions like this one, come about because we get entrenched in one way of thinking. We often spend a long time focused on one programming language and loose touch with another. You then start trying to find solutions to all your problems with that one language. It often means trying to push a square peg into a round hole. The adage of “give a man a hammer and everything looks like a nail” comes to mind.

之所以出现这样的许多问题,是因为我们以一种思考的方式根深蒂固。 我们经常花很长时间专注于一种编程语言,而与另一种语言失去联系。 然后,您开始尝试寻找使用该一种语言解决所有问题的解决方案。 这通常意味着试图将方钉推入圆Kong。 “给人一个锤子,一切看起来都像钉子”的格言浮现在脑海。

The long and short of it is to use the right tool for the right job and that might mean using both. So next time your working on a Javascript app and thinking that SSR might be necessary, why not take a week out to refresh your PHP skills and see if that mixed with a React or Vue UI might be a better fit for your project.

总之,使用正确的工具完成正确的工作可能意味着同时使用两者。 因此,下一次您使用Javascript应用程序并认为可能需要SSR时,为什么不花一个星期的时间来刷新您PHP技能,并查看将它与React或Vue UI混合在一起是否更适合您的项目。

翻译自: https://medium.com/swlh/has-javascript-killed-php-91cd1ee78312

javascript 卡死

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值