如何使用PHP编辑外部css文件? [英] How do I edit an external css file with PHP?
问题描述
我有一个带有图像的页面。我希望客户端能够将新映像上传到数据库,然后能够从CMS中切换映像。一旦他们在CMS中切换,我想要PHP编辑外部css文件中的背景图像。
I have a page with an image. I want the client to be able to upload a new image into the database and then be able to switch out the image from within the CMS. Once they switch it in the CMS, I want PHP to edit the background image in the external css file.
有可能吗?我知道如何让PHP切换出HTML标记中的图像标记,但我想能够编辑外部css文件,以保持我的代码更清洁。
Is it possible to do that? I know how to have PHP switch out an image tag in the HTML markup, but I would like to be able to edit the external css file to keep my code cleaner.
推荐答案
如果您使用Apache,您还可以将PHP代码嵌入您的CSS文件中,将其添加到您的apache conf:
If you're using Apache, you can also embed PHP code in your CSS files, by adding this to your apache conf:
AddHandler application/x-httpd-php .css
这篇关于如何使用PHP编辑外部css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!