这是我的问题的样子:
如你所见,有3个图像(div),我不想删除每个div之间的黑色间距.
最重要的是,当我在我的CSS中放置以下内容时:
* {
padding: 0;
margin: 0;
}
Run Code Online (Sandbox Code Playgroud)
它看起来很好:
问题是我不能使用padding: 0
和margin: 0
我的整个HTML,因为其他属性将被打破然后...
我试图添加:padding:0
和margin:0
每个div(图像),但它不起作用.
HTML来源:
<div id="sidebar-left" class="sidebar" role="complementary">
<div class="sb-ui sb-title"><h3>Account</h3></div>
<div class="sb-con">
<ul>
<li><a href="index.php?subtopic=accountmanagement">My Account</a></li>
<li><a href="index.php?subtopic=accountmanagement&action=logout">Logout</a></li>
</ul>
</div>
<div class="sb-ui sb-end"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
#sidebar-left {
margin-right: 9px;
}
.sidebar {
width: 170px;
position: relative;
bottom: 7px;
}
.sidebar, #content {
float: left;
}
.sb-title {
height: 60px;
text-align: center;
}
.sb-ui {
background: url("../images/ui/sidebar_ui.png");
}
.sb-con { …
Run Code Online (Sandbox Code Playgroud) 这是我的HTML:
<div id="user-avatar"><img src="/imgs/frame.png" alt=""/></div>
Run Code Online (Sandbox Code Playgroud)
user-avatar
课程如下:
#user-avatar {
width: 100px;
height: 100px;
margin: auto;
position: relative;
background: url(images/avatars/128.jpg) 50% 50% no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
帧:
#user-avatar img {
position: absolute;
top: 50%;
left: 50%;
width: 122px;
height: 127px;
margin-top: -62px;
margin-left: -63px;
}
Run Code Online (Sandbox Code Playgroud)
原始user-avatar
背景图像尺寸是23x25,但我希望它被调整为100x100px,问题是我在width: xxx
属性中设置的任何东西都不起作用.框架后面的头像每次都有原始尺寸.
我是Code Igniter的新手(我正在学习它的第一个框架).
我在控制器中得到了这个:
if ($this->form_validation->run() === FALSE)
{
$this->load->view('account/register', $data);
}
else
{
$data['message'] = $this->lang->line('account_created');
$this->register->insert_account();
$this->load->view('account/register_success', $data);
}
Run Code Online (Sandbox Code Playgroud)
如果表单成功验证,它只会更改视图,但仍然可以点击刷新按钮,并重新发送表单数据 - 这对我来说不是一个大问题,因为我正在检查字段是否唯一,但是对我来说,防止重新发送表单数据会更好.
通常在干净的PHP我会使用,header("Location: ...");
但我在这里加载一个视图,因此重定向后将无法访问它 - 不是吗?
你有什么建议吗?
我想从我的数组中获得三个高值,但它也应该通过键正确排序.
我有这个代码:
<?php
$a = array(130, 1805, 1337);
arsort($a);
print_r($a);
?>
Run Code Online (Sandbox Code Playgroud)
以上输出如下:
Array
(
[1] => 1805
[2] => 1337
[0] => 130
)
Run Code Online (Sandbox Code Playgroud)
它的工作正常,但我希望它还可以从最高到最低值对它进行排序.
例:
Array
(
[2] => 1805
[1] => 1337
[0] => 130
)
Run Code Online (Sandbox Code Playgroud)
要明确:我希望按键排序:数组键号2将始终用于最高值,数组键号0将始终用于最低值.
我怎样才能做到这一点?
如果你不明白,请告诉我.
我使用的PDO,而我$_POST['arraywithdata']
是提起阵列数字值.我认为这不够安全,我只是不确定并防止自己陷入黑客攻击.
这是我的代码:
$arr = $_POST['arraywithdata'];
$SQL->query("UPDATE `data_s` SET `set` = 1 WHERE `id` IN " . implode(", ", $arr));
Run Code Online (Sandbox Code Playgroud)
如您所见,我不会检查int中的邮政编码或其他内容.
我应该使用类似的东西:
implode(", ", (int) $arr)
Run Code Online (Sandbox Code Playgroud)
?
我猜上面的代码不起作用,因为数组不能是整数.
我已经安装了ReCaptcha,配置了我的公钥和私钥,一切都很好,直到我输入任何答案,无论它是好还是错,它甚至都没有响应发生的错误.
这是我的代码:
require_once('recaptchalib.php');
$resp = recaptcha_check_answer ($config->privkey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
echo $resp->error;
}
Run Code Online (Sandbox Code Playgroud) 我收到这个致命错误消息:Using $this when not in object context.
此类在CodeIgniter中设置为库.
这是我的班级:
class My_class {
function __construct()
{
$this->app = base_url('application') . '/cache/';
if ($this->expire_after == '')
{
$this->expire_after = 300;
}
}
static function store($key, $value)
{
$key = sha1($key);
$value = serialize($value);
file_put_contents( $this->app . $key.'.cache', $value);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在通过它初始化它autoload.php
.它抛出错误的行:
file_put_contents( $this->app . $key.'.cache', $value);
我的问题在哪里?
默认情况下,当我在CakePHP View中调用提交按钮时,如下所示:
echo $this->Form->end('Save');
Run Code Online (Sandbox Code Playgroud)
以上将输出:
<div class="submit">
<input type="submit" value="Save"/>
</div>
Run Code Online (Sandbox Code Playgroud)
机器人我不仅仅是这样:
<input type="submit" class="submit" value="Save"/>
Run Code Online (Sandbox Code Playgroud)
我正在搜索手册,但没有发现任何有趣的东西.
首先,我曾经function_exists
检查过,如果我的功能先前被宣布但没有帮助.
这是我的代码:
if ( !function_exists('something') ) {
function something($params) {
[..]
}
}
Run Code Online (Sandbox Code Playgroud)
当我进入已声明此功能两次的页面时,发生以下错误: Fatal error: Cannot redeclare something() (previously declared in [..])
所以问题是,我如何检查,如果函数已经存在,如果存在则跳过加载两次?
这是发生的错误:
Warning: simplexml_load_file() [function.simplexml-load-file]: dump.xml:43: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xC7 0xD2 0xB7 0xCE in /usr/local/www/_test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: <item id="740" name="'Ç??Î?Š ??šÚ¸Ó¸Ž'" in /usr/local/www/_test.php on line 3
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /usr/local/www/_test.php on line 3
Run Code Online (Sandbox Code Playgroud)
Whar是问题吗?
我想问题是因为这个字符串:Ç??Î?Š ??šÚ¸Ó¸Ž
但是有没有办法强行加载它?