简体   繁体   English

Twitter Bootstrap中的PHP文件?

[英]PHP file in Twitter Bootstrap?

I want to develop a site with Bootstrap css. 我想用Bootstrap CSS开发一个站点。

Because I will have some form that connect to the database, so I will make some of my file in HTML and the rest in PHP. 因为我将使用某种形式来连接数据库,所以我将使用HTML编写部分文件,而使用PHP编写其余部分。

But the problem is that Bootstrap is only compatible in .HTML file. 但是问题在于Bootstrap仅与.HTML文件兼容。

So how I can do this? 那我该怎么做呢? How to make it possible? 如何使其成为可能?

You can use HTML inside a PHP file just as if it was only a HTML file. 您可以在PHP文件中使用HTML,就好像它只是HTML文件一样。 You can place your 你可以把你的

PHP is server side code meaning the server hosting the .php file interprets what code is within the tags and then displays the entire page to the browser just as any HTML page or similar depending on what your script does. PHP是服务器端代码,这意味着承载.php文件的服务器将解释标记内的代码,然后将整个页面显示为浏览器,就像任何HTML页面或类似页面一样,具体取决于脚本的作用。 The browser doesn't handle any PHP. 浏览器不处理任何PHP。

So to use bootstrap within a php page you could do something like this: 因此,要在php页面中使用bootstrap,可以执行以下操作:

<?php
$example = 'example';
?>
<html>
<head>
<title>PHP in HTML Example</title>
<script src="js/bootstrap.min.js"></script>
<link rel='stylesheet' type='text/css' href='css/bootstrap.min.css'>
</head>
<body>
<h1>Short code <?=$example;?></h1>
</body>
</html>

只需在文本编辑器中使用另存为 ,并将html文件另存为.php即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM