我想在鼠标上突出显示我的表行,但我还没有找到一种不使用Javascript的方法.这在CSS中不可能吗?
我试过这个:
tr:hover {
background: #000;
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用.使用td:hover作品,但我想改变整个表格行的背景颜色.
是否有纯CSS/HTML方式,或者我将不得不求助于Javascript?
我在共享主机Bounceweb上,我正在尝试添加一些重写规则,以使我的链接看起来更漂亮.
其中一条规则是使url:http://mysite.com/upload指向:http://mysite.com/upload.php.我在.htaccess文件中有这个:
RewriteEngine on
RewriteRule ^upload$ upload.php
Run Code Online (Sandbox Code Playgroud)
但它给我的全部是500内部服务器错误.我查看了我的日志,这出现了很多:
[alert] [client 81.179.29.185] /home/minecraf/public_html/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Run Code Online (Sandbox Code Playgroud)
这是否意味着我的主人不支持.htaccess?如果不这样做,那就太蹩脚了.我已经尝试将.htaccess的权限更改为777,但它没有帮助.
谢谢!
我想使用CSS在元素中间对齐一些文本.这是我的标记:
<div id="testimonial">
<span class="quote">Some random text that spans two lines</span>
</div>
Run Code Online (Sandbox Code Playgroud)
和相关的CSS:
#testimonial {
background: url('images/testimonial.png') no-repeat;
width: 898px;
height: 138px;
margin: 0 auto;
margin-top: 10px;
text-align: center;
padding: 0px 30px 0px 30px;
}
.quote {
font-size: 32px;
font-family: "Times New Roman", Verdanna, Arial, sans-serif;
vertical-align: middle;
font-style: italic;
color: #676767;
text-shadow: 1px 1px #e7e7e7;
}
Run Code Online (Sandbox Code Playgroud)
通常要进入.quote垂直中间#testimonial,我会这样做:
.quote { line-height: 138px; }
Run Code Online (Sandbox Code Playgroud)
但这会打破布局,因为文本.quote跨越多行.
正如你所看到的,我已经尝试过这样做vertical-align: middle;,但也无效.
任何帮助表示赞赏.干杯.
我正在使用cURL使用PHP将图像文件从一台服务器传输到另一台服务器.这是我的cURL代码:
// Transfer the original image and thumbnail to our storage server
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://' . $server_data['hostname'] . '.localhost/transfer.php');
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
'upload[]' => '@' . $tmp_uploads . $filename,
'upload[]' => '@' . $tmp_uploads . $thumbname,
'salt' => 'q8;EmT(Vx*Aa`fkHX:up^WD^^b#<Lm:Q'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$resp = curl_exec($ch);
Run Code Online (Sandbox Code Playgroud)
这是我上传到的服务器上的transfer.php中的代码:
if($_FILES && $_POST['salt'] == 'q8;EmT(Vx*Aa`fkHX:up^WD^^b#<Lm:Q')
{
// Save the files
foreach($_FILES['upload']['error'] as $key => $error)
{
if ($error …Run Code Online (Sandbox Code Playgroud) 我想在两个范围之间创建一个10的倍数的随机数.
例如,如果我给函数提供参数0, 100,它将返回以下数字之一:
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
Run Code Online (Sandbox Code Playgroud)
但没有像63或55.
是的,我知道这会击败真正的"随机性",但我只需要一个快速简单的方法来获得两个范围之间的10的倍数.
谢谢.:)
我想要阻止所有与这个正则表达式模式不匹配的字符:[a-zA-Z0-9_-].
通常我会这样做:
preg_replace("[a-zA-Z0-9_-]", "", $var);
Run Code Online (Sandbox Code Playgroud)
但显然这对我想要的东西产生了相反的效果.正则表达式中是否有NOT?我怎样才能删除任何与模式不匹配的字符?
谢谢.
我正在尝试使用jQuery在我的页面上快速选择一个元素.这是到目前为止的代码:
$('#row-58708 > div.cell name > div > strong').html('tesing');
Run Code Online (Sandbox Code Playgroud)
这是标记:
<div id="row-58708" class="row">
<div class="cell name">
<div>
<strong>Skin name</strong>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我知道我所写的内容远远不够,但无论如何我无法解决这个问题......任何人都可以伸出援助之手吗?干杯!
我需要像这样转换一个查询字符串:
HTTP://localhost/view.php ID = 12345
进入:
但是,我还计划在URL的末尾添加一个字符串,以便搜索引擎受益,如下所示:
HTTP://本地主机/ 12345/NameOfTheSkin
有点像Wowhead如何做他们的URL:
http://www.wowhead.com/item=49623/shadowmourne
Run Code Online (Sandbox Code Playgroud)
请注意如何将字符串"shadowmourne"更改为任何内容,它仍将指向项ID 49623.
基本上,我需要忽略最后的字符串.
欢迎任何帮助,欢呼.:)
由于我的脚本的限制,我遇到了一个问题,我需要确保一个字符串匹配两个正则表达式模式之一,而只调用preg_match()一次.
这是我的一些代码:
public static function get_file_host_from_link($link)
{
foreach(Filehosts::$file_hosts as $key => $val)
{
if(preg_match("#{$val["regex"]}#", $link))
{
// We have a match, return this file host information
return $key;
}
}
// We've looped through all the file hosts and it hasn't matched,
// return false
return false;
}
Run Code Online (Sandbox Code Playgroud)
现在,匹配Fileserve.com URL的问题在于可以有两种类型的有效URL结构.其中之一是:
http://www.fileserve.com/file/aHd8AHD
Run Code Online (Sandbox Code Playgroud)
和另外一个:
http://www.fileserve.com/file/zR8VJVM/file_name.zip
Run Code Online (Sandbox Code Playgroud)
目前,我可以使用这个正则表达式完美匹配第一个结构:^http://www.fileserve.com/file/[a-zA-Z0-9]+$但我还需要使用以下内容匹配其他URL结构:http://www.fileserve.com/[a-zA-Z0-9]+/[a-zA-Z0-9_-\.]+$.如何使用现有代码执行此操作并仅调用preg_match()一次?我想过这样的事情:
(^http://www.fileserve.com/file/[a-zA-Z0-9]+$|http://www.fileserve.com/[a-zA-Z0-9]+/[a-zA-Z0-9_-\.]+$)
据我所知,这意味着"匹配第一个正则表达式或第二个",但我不知道这是否有效.
谢谢!
php ×3
.htaccess ×2
css ×2
html ×2
javascript ×2
regex ×2
apache ×1
clean-urls ×1
curl ×1
file-upload ×1
jquery ×1
math ×1
mod-rewrite ×1
preg-match ×1
preg-replace ×1
random ×1
rewrite ×1
xhtml ×1