如果我想在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文件中工作吗?
发布评论