Polymer可以在PHP文件中工作吗? [英] Does Polymer work in PHP files?

查看:74
本文介绍了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文件中工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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