Does Polymer work in PHP files?

你离开我真会死。 提交于 2019-12-24 13:03:47

问题


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.

Thanks!


回答1:


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.




回答2:


I just dropped the components from the Polymer tutorial into a test CakePHP project, and it works great.



来源:https://stackoverflow.com/questions/28048700/does-polymer-work-in-php-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!