我想在我的.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)
但显然这不起作用.有什么方法可以做到这一点吗?
谢谢!
我刚刚学习 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>?
我在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> @row[0] @row[1] @row[2] @row[3] @row[4]</div>
html
}
Run Code Online (Sandbox Code Playgroud)
但是当我在浏览器中运行index.php时,它会打印dbcon.pl文件中的所有代码而不是执行它
如何克服这个问题?
注意:我在Windows环境中运行它
还有其他办法吗?
我用C++只用了几个星期就自我启动了.在访谈期间,我将被要求在文本编辑器中编写一个简单的任务并编译它,首先我需要包含C++库,我知道如何在IDE中执行它但是如何在文本编辑器中执行它,可以有人帮忙吗?
在我正在进行的项目中,我命名了我的一个文件math.h,其中obvisouly也是标准库头的名称.
一切运行良好,直到我开始使用gcc的-I选项:我整理我的文件到不同的目录,比如src,obj和inc页眉.
我结束了类似的事情
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不认为我的标题是标准的?
当然我可以重命名该文件,但这只是避免了这个问题 - 即使我最终这样做,我希望知道解决方案,以防我再次遇到这个问题.
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