Polymer可以在PHP文件中工作吗?

编程入门 行业动态 更新时间:2024-10-28 08:16:31
本文介绍了Polymer可以在PHP文件中工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我想在PHP项目中使用Polymer,我可以只使用PHP文件中的元素,还是应该仅使用post core-ajax和post处理后端并将文件保留为HTML?

If I wanted to use Polymer in a PHP project - could I just use the elements in my PHP file, or should I simply be using post core-ajax and posts to handle the backend and leave files as HTML?

我还没有找到很多有关它的文档.

I haven't found a lot of documentation about it.

谢谢!

推荐答案

是可以的.但是,如果使用php,则可以通过在其他输出的php数组上使用json_encode将json反馈回html中的聚合物应用程序.聚合物在初始加载时加载所有数据的方式,这将使应用程序加载时间更长,因为php必须在页面可以呈现之前对所有内容进行预处理(这是我的经验.对于那些不希望查找单个文件的人来说,这可能不是问题页面应用程序). IMO如果将php用于后端,最好让php将json反馈到聚合物应用程序,然后仅与core-ajax或任何其他ajax调用连接.

yes it can work. but if using php you could just feed back json to a polymer app in html by using json_encode on your php array of other output. the way polymer loads all the data on the initial load it would make app loading longer cause php would have to pre process everything before the page could render (this was my experience. and might not be the issue for someone that is not looking for single page app). IMO if using php for a backend it would be better to have php feed back json to a polymer app and just connect with core-ajax or any other ajax call.

更多推荐

Polymer可以在PHP文件中工作吗?

本文发布于:2023-08-02 15:35:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1278942.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   工作   Polymer   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!