标签: include

在.php文件中包含CSS

我想在我的.php文件中包含一个css文件.

在.php文件中,我有;

<?php
Loads of code..
?>
Run Code Online (Sandbox Code Playgroud)

我想要这样......

<?php
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
Loads of code..
?>
Run Code Online (Sandbox Code Playgroud)

但显然这不起作用.有什么方法可以做到这一点吗?

谢谢!

css php include include-path

-4
推荐指数
2
解决办法
4万
查看次数

“使用 std::string”和“#include &lt;string&gt;”有什么区别

我刚刚学习 C++,我不太明白将using std::stringVS放在#include <string>主文件顶部之间的区别。

我似乎能够定义字符串而无需#include <string>这里:

#include <iostream>
using std::cout; using std::cin;
using std::endl;
using std::string;

int main()
{
    string s = "hi";
    cout << s;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这似乎运行没有问题,那么为什么我会出现这个问题呢#include <string>

c++ string using include

-4
推荐指数
1
解决办法
564
查看次数

如何在PHP中包含.pl(PERL)文件

我在php(index.php)中有两个页面,在Perl(dbcon.pl)中有另一个页面.

基本上我希望我的php文件只显示UI,所有数据操作都将在Perl文件中完成.

我试过index.pl

<?php include("dbcon.pl");?>
<html>
<br/>PHP</br>
</html>
Run Code Online (Sandbox Code Playgroud)

和dbcon.pl有

#!/usr/bin/perl
use strict;
use warnings;
use DBI;

use CGI::Simple;
my $cgi = CGI::Simple->new;
my $dsn = sprintf('DBI:mysql:database=%s;host=%s','dbname','localhost');

my $dbh = DBI->connect($dsn,root =>'',{AutoCommit => 0,RaisError=> 0});


my $sql= "SELECT * FROM products";
my $sth =$dbh->prepare($sql);
$sth->execute   or die "SQL Error: $DBI::errstr\n";
while (my @row = $sth->fetchrow_array){
print $cgi->header, <<html;
<div>&nbsp;@row[0]&nbsp;@row[1]&nbsp;@row[2]&nbsp;@row[3]&nbsp;@row[4]</div>
html
}
Run Code Online (Sandbox Code Playgroud)

但是当我在浏览器中运行index.php时,它会打印dbcon.pl文件中的所有代码而不是执行它

如何克服这个问题?

注意:我在Windows环境中运行它

还有其他办法吗?

php perl include

-5
推荐指数
1
解决办法
5467
查看次数

C++:包括在文本编辑器中编写代码的时候

我用C++只用了几个星期就自我启动了.在访谈期间,我将被要求在文本编辑器中编写一个简单的任务并编译它,首先我需要包含C++库,我知道如何在IDE中执行它但是如何在文本编辑器中执行它,可以有人帮忙吗?

c++ compilation text-editor include

-5
推荐指数
1
解决办法
1073
查看次数

GCC混淆标准标题与个人名称相同

在我正在进行的项目中,我命名了我的一个文件math.h,其中obvisouly也是标准库头的名称.

一切运行良好,直到我开始使用gcc的-I选项:我整理我的文件到不同的目录,比如src,objinc页眉.

我结束了类似的事情

gcc ... -Iinc/
Run Code Online (Sandbox Code Playgroud)

现在我的问题是我使用的另一个库(SDL,顺便说一句)#include标准的 math.h头文件(位于/usr/include/math.h),而GCC给它自己的math.h(在like中找到/home/me/my_project/inc/math.h),显然这不能编译.

所以我的问题是,如何让GCC不认为我的标题是标准的?
当然我可以重命名该文件,但这只是避免了这个问题 - 即使我最终这样做,我希望知道解决方案,以防我再次遇到这个问题.

c gcc include

-5
推荐指数
1
解决办法
53
查看次数

标签 统计

include ×5

c++ ×2

php ×2

c ×1

compilation ×1

css ×1

gcc ×1

include-path ×1

perl ×1

string ×1

text-editor ×1

using ×1