Home >Backend Development >PHP Problem >Can css be written in php?

Can css be written in php?

青灯夜游
青灯夜游Original
2019-10-15 15:51:467012browse

Can css be written in php?

Can I write css in php?

css can be written in php. In PHP, HTML, CSS and JavaScript codes are treated as strings and then parsed in the browser.

Introduce css styles into PHP scripts. The code example is as follows:

<?php
header("content-type:text/html;charset=utf-8");
echo &#39;<p style="color:red;">Hello!</p>&#39;;
?>

Output:

Can css be written in php?

You can also introduce external CSS files.

<?php
echo  &#39;<link rel=\"stylesheet\" type=\"text/css\" href=\"theme.css\" />&#39;;
?>

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Can css be written in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn