我有PHP 5.4的新语法的问题我的代码在实例化时具有成员访问权限
$oClass = (new Foo)->bar();
$oClass->bar2();
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
致命错误:在非目标上调用成员函数bar2()
为什么?
编辑:我添加return $this;了方法Foo :: bar(),现在它的工作原理
我很困惑,因为PHP接受以下条件.
<?php
$b = true;
if($b == 'anything')
echo 'ok';
else
echo 'no';
?>
Run Code Online (Sandbox Code Playgroud)
好吧,PHP显示ok.我还是不明白怎么可能.
也许,你可以为我澄清一下.
我想知道如何创建一个灯箱,用照链接的网址加载页面中的图像
这是我的代码,但它不起作用:
$("a.picture").click(function() {
$.fancybox({
'padding' : 0,
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'titlePosition' : 'over',
'type' : 'image',
'titleFormat' : function(title, currentArray,
currentIndex, currentOpts) {
return '<span id="fancybox-title-over">' + (currentIndex +
1) + ' / ' + currentArray.length + (title.length ? ' ' +
title : '') + '</span>';
}
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
和HTML代码
<a class="picture" href="http://localhost/test/my_page.html" title="Picture Page">Link</a>
谢谢!
我不能在"not"选择器中放两个不同的规则示例:
此代码有效:
input:not([type=submit]) {
// Styling here
}
Run Code Online (Sandbox Code Playgroud)
但是这段代码不起作用:
input:not([type=submit], [type=reset]) {
// Styling here
}
Run Code Online (Sandbox Code Playgroud)
为什么第二个代码不起作用?