我正在做一个tumblr页面.我有两个不同的html页面背景,我希望DAY背景显示从早上7点到晚上8点,夜晚背景显示从晚上8点到早上7点.
我决定在php中这样做,但是当涉及到php时,我总是新手.我的朋友给我发了一个我可以使用的示例代码.但我不知道该怎么做.你们能帮忙吗?
这是示例代码.
<?php
header('content-type: text/css');
date_default_timezone_set("America/Vancouver");
$now = date('G');
if ($now < 12) {
$bg = '#FFFFFF';
} else {
$bg = '#000000';
}
?>
body {
background: <?php echo $bg; ?>;
}
Run Code Online (Sandbox Code Playgroud) 我通过Windows Web App Gallery在带有IIS7的Windows 7 x64计算机上安装了PHP.一切似乎都很好,一个简单的phpinfo()页面就像你想象的那样.但是,每当我对PHP页面发出POST请求时,请求就会永远挂起.请参阅下面非常简单的测试页面...它甚至没有任何动态内容.
我浪费了太多时间在这上面.有任何想法吗?谢谢你!
page.php文件:
<html>
<body>
<form action="page.php" method="post">
<textarea name="apa"></textarea>
<input type="submit" value="ok" />
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
处理程序映射:
<handlers>
<add name="PHP_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>
Run Code Online (Sandbox Code Playgroud) 我想捕获Enter键以使按钮单击
我有这个javascript:
function doClick(buttonName,e)
{
//the purpose of this function is to allow the enter key to
//point to the correct button to click.
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
if (key == 13)
{
//Get the button the user wants to have clicked
var btn = document.getElementById('submit');
if (btn != null)
{ //If we find the button click it
btn.click();
event.keyCode = 0
}
}
}
Run Code Online (Sandbox Code Playgroud)
用html
<input type="button" id="submit" value="Search" onClick="doSomeThing();" /> …Run Code Online (Sandbox Code Playgroud) 示例用户输入
http://domain.com/
http://domain.com/topic/
http://domain.com/topic/cars/
http://www.domain.com/topic/questions/
Run Code Online (Sandbox Code Playgroud)
我想要一个PHP函数来使输出像
domain.com
domain.com/topic/
domain.com/topic/cars/
www.domain.com/topic/questions/
Run Code Online (Sandbox Code Playgroud)
让我知道 :)
我有一个这样的 SQL 查询:
SET @q =
(SELECT Id AS '@Id', COUNT(Occ) AS '@Occ' FROM Details
GROUP BY Id
ORDER BY COUNT(Occ) DESC, Id ASC
FOR XML PATH('Data'), ROOT('Stats'), ELEMENTS, TYPE)
Run Code Online (Sandbox Code Playgroud)
我设置 AS @Id 和 AS @Occ 以便 FOR XML 指令将输出转换为属性而不是元素。
我的问题: SELECT 和 ORDER BY 中两次出现 COUNT(Occ) 是否会导致计数执行两次,如果是这样,如何防止这种情况发生?
谢谢!
我在我的电脑上安装了kvm:
sudo apt-get install qemu-kvm
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行命令时:
qemu-kvm -m 384 -cdrom guestos.iso -hda image.img -boot d
Run Code Online (Sandbox Code Playgroud)
要从cdrom引导ISO映像,它会给出错误,指出"找不到qemu-kvm命令".我是否错过了安装任何所需的包裹?如果没有,缺少什么?
我有日期和时间存储在我的数据库中,我不想同时显示两者,只显示日期本身.当我将日期/时间存储在变量中时,如何仅输出C#中的日期?
我正在尝试使用imagettftext,但显然它在GD2中使用了点大小,但我的所有大小都是以像素为单位,还有其他任何我可以使用的功能,还是以任何方式将像素转换为点?
我有这个代码..
CEngineLayer::CEngineLayer(void)
{
// Incoming creation of layers. Wrapping all of this in a try/catch block is
// not helpful if logging of errors will happen.
logger = new (std::nothrow) CLogger(this);
if(logger == 0)
{
std::bad_alloc exception;
throw exception;
}
videoLayer = new (std::nothrow) CVideoLayer(this);
if(videoLayer == 0)
{
logger->log("Unable to create the video layer!");
std::bad_alloc exception;
throw exception;
}
}
IEngineLayer* createEngineLayer(void)
{
// Using std::nothrow would be a bad idea here as catching things thrown
// from the …Run Code Online (Sandbox Code Playgroud) 如何使用反射调用被派生类重写的基本方法?
class Base
{
public virtual void Foo() { Console.WriteLine("Base"); }
}
class Derived : Base
{
public override void Foo() { Console.WriteLine("Derived"); }
}
public static void Main()
{
Derived d = new Derived();
typeof(Base).GetMethod("Foo").Invoke(d, null);
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud)
此代码始终显示"派生"...
php ×4
.net ×2
c# ×2
bad-alloc ×1
c++ ×1
datetime ×1
dynamic-css ×1
function ×1
gd ×1
html ×1
http-post ×1
iis ×1
iis-7 ×1
javascript ×1
kvm ×1
new-operator ×1
preg-replace ×1
qemu ×1
reflection ×1
sql ×1
sql-server ×1
sqlxml ×1
throw ×1
windows ×1