问题
I am trying to include a css file to my .php file.
Inside the .php file, I have;
<?php
Loads of code..
?>
I'm wanting it like this..
<?php
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
Loads of code..
?>
But obviously that doesn't work. Is there any way I can do this?
Thanks!
回答1:
You can use echo..
<?php
echo '<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">';
?>
回答2:
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<?php
Loads of code..
?>
回答3:
Uhhhm... You mean something likes this?
<?php
echo '<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">';
Loads of code..
?>
回答4:
I have posted a simple solution here : https://navydadon.wordpress.com/2016/02/18/css-in-php-file/ hope it will helps :)
回答5:
The same happened for me a long ago. The best way to solve this is by inserting the css files in all of the files you have included to make your main php page.
来源:https://stackoverflow.com/questions/15086785/including-css-in-php-file