gongpex Posted July 13, 2018 Share Posted July 13, 2018 Hello everyone, It safe or not put php code on css file like this : <?php header("Content-type: text/css; charset: UTF-8"); $db = new mysqli("host", "username", "password", "database"); if ($db->connect_error) { die("Connection failed: " . $db->connect_error); } ?> /* css code */ Q : if not safe please tell me how to use php inside css. Thanks Link to comment Share on other sites More sharing options...
niche Posted July 13, 2018 Share Posted July 13, 2018 More context please Link to comment Share on other sites More sharing options...
justsomeguy Posted July 13, 2018 Share Posted July 13, 2018 As long as that file is executed by PHP then it's as "safe" as any other PHP file. Link to comment Share on other sites More sharing options...
niche Posted July 13, 2018 Share Posted July 13, 2018 this might help https://css-tricks.com/css-variables-with-php/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now