是否有一个MySQL(或只是SQL)的在线工具,可以让我快速测试一些随机出现的想法?
像JSFiddle for HTML/CSS/JS或http://writecodeonline.com/php/ for PHP?
这样的东西,但对于MySQL.
提前致谢.
我已经阅读了其他主题,但它并没有解决我的问题所以:
我有这个
->add('role', 'choice', array(
'label' => 'I am:',
'mapped' => true,
'expanded' => true,
'multiple' => false,
'choices' => array(
'ROLE_NORMAL' => 'Standard',
'ROLE_VIP' => 'VIP',
)
))
Run Code Online (Sandbox Code Playgroud)
无论我做什么,我都会收到这个错误:
Notice: Array to string conversion in C:\xampp\htdocs\xxx\vendor\symfony\symfony \src\Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList.php line 458
Run Code Online (Sandbox Code Playgroud)
在我的表单类型中,甚至没有调用setRole方法(当我将它重命名为某些垃圾时,仍然会发生错误).为什么会这样?
//编辑
完整堆栈跟踪:
in C:\xampp\htdocs\xxx\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList.php at line 458 -
*/
protected function fixIndex($index)
{
if (is_bool($index) || (string) (int) $index === (string) $index) {
return (int) $index;
}
at ErrorHandler ->handle ('8', 'Array to string conversion', 'C:\xampp\htdocs \xxx\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList.php', '458', array('index' …Run Code Online (Sandbox Code Playgroud) 我在我的实体中有这个方法:
/**
* @ORM\PreUpdate()
* @ORM\PrePersist()
*/
public function preStore() {
if ($this->getPictureFile()) {
$newFilename = sha1(mt_rand());
$newFilename = $newFilename . '.' . ($this->getPictureFile()->guessExtension());
$this->setPictureFilename($newFilename);
}
}
Run Code Online (Sandbox Code Playgroud)
当持久化对象时,一切都运行得很完美但是在更新时根本没有触发方法,我测试了这样:
/**
* @ORM\PreUpdate()
* @ORM\PrePersist()
*/
public function preStore() { var_dump('asdasdasdadsdasdas');
if ($this->getPictureFile()) {
$newFilename = sha1(mt_rand());
$newFilename = $newFilename . '.' . ($this->getPictureFile()->guessExtension());
$this->setPictureFilename($newFilename);
}
}
Run Code Online (Sandbox Code Playgroud)
并且在持久化var_dump工作,但当我更新对象 - 它没有.为什么?
当我想为symfony2表单元素添加一些属性时,我可以使用"attr"属性.但是我如何为起始表单标签本身提供一些id/class/style/other?
我有一个.htaccess文件,如下所示:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]
Run Code Online (Sandbox Code Playgroud)
我的网页目录中有这个文件.如果有文件,有没有办法强制此规则停止重写?
例如:我有一个css/style.css文件,但服务器返回404,因为mod_rewrite规则有效.如果我关闭mod_rewrite,则找到该文件.
例如,当我有一个图像:
<img src="10px_image.png" alt="Some image" style="width: 100%" />
Run Code Online (Sandbox Code Playgroud)
它的高度会根据图像的宽度自动缩放(例如,当您调整浏览器窗口大小时,可以看到它).有没有办法对html中的其他元素做同样的事情?
如果我想在IE8中打开新的HTML5标签,我可以使用html5shiv,但是如何允许其他HTML5内容如属性(模式,必需等等?).对于<= IE7,我只能显示"更新您的浏览器"消息,但IE8是WinXP的最新版本,Win7的默认值,因此我需要一些HTML5属性才能使用它.不知道怎么办呢?
我正在尝试创建一个接收数组作为参数的纯函数,现在我想替换给定索引处的元素而不修改提供的数组参数.
基本上我正在寻找这样的东西:
export const muFunc = (arr) => {
return arr.replaceElementAt(1, 'myNewValue'); // This doesnt modify arr at all
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有这个:
<div id="parent">
<div id="child">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function() {
$('#parent').on('mouseout', function() {
alert('Mouse out!');
});
});
Run Code Online (Sandbox Code Playgroud)
现在,当我将鼠标移动到蓝色块上并将其移出某处时,一切正常.但是当我将鼠标移动到蓝色块上然后再移动到红色块上时,也会触发mouseout事件.为什么会发生这种情况?如何在实际将鼠标移出块时才能发生mouseout事件?