这是更新的问题:
当前查询正在执行以下操作:
$sql1 = "TRUNCATE TABLE fubar";
$sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu";
Run Code Online (Sandbox Code Playgroud)
第一次运行包含此方法的方法时,它会在truncate上生成错误消息,因为该表尚不存在.
是我唯一的选择CREATE TABLE,运行TRUNCATE TABLE,然后填写表格?(3个单独的查询)
原来的问题是:
我一直很难在MySql中找出以下内容是否可行,而无需编写块sql:
CREATE TABLE fubar IF NOT EXISTS ELSE TRUNCATE TABLE fubar
Run Code Online (Sandbox Code Playgroud)
如果我在create table之前单独运行truncate,并且该表不存在,那么我会收到一条错误消息.我试图消除该错误消息,而不必添加任何更多的查询.
此代码将使用PHP执行.
这是我想在HTMLPurifier中允许的一种特殊的标签组合,但似乎无法使组合起作用.
我可以让脚本标签工作,但然后嵌入标签被删除(我使用HTML.Trusted = true启用脚本标签).当我重新嵌入标签时,脚本标签被删除(我删除了HTML.Trusted).以下是我的配置:
$config->set('HTML.Trusted', true);
$config->set('HTML.SafeEmbed', true);
$config->set('HTML.SafeObject', true);
$config->set('Output.FlashCompat', true);
Run Code Online (Sandbox Code Playgroud)
我甚至尝试添加以下内容,这使事情变得更糟:
$config->set('HTML.Allowed', 'object[width|height|data],param[name|value],embed[src|type|allowscriptaccess|allowfullscreen|width|height],script[src|type]');
Run Code Online (Sandbox Code Playgroud)
而且,无论如何,我似乎无法让iframe工作.我尝试添加:
$config->set('HTML.DefinitionID', 'enduser-customize.html iframe');
$config->set('HTML.DefinitionRev', 1);
$config->set('Cache.DefinitionImpl', null); // remove this later!
$def = $config->getHTMLDefinition(true);
$iframe = $def->addElement(
'iframe', // name
'Block', // content set
'Empty', // allowed children
'Common', // attribute collection
array( // attributes
'src*' => 'URI#embedded',
'width' => 'Pixels#1000',
'height' => 'Pixels#1000',
'frameborder=' => 'Number',
'name' => 'ID',
)
);
$iframe->excludes = array('iframe' => true);
Run Code Online (Sandbox Code Playgroud)
任何有关使整个组合工作的帮助,甚至是带有object/param和embed的脚本标签都会非常感激!!!
哦,是的,这显然不适合所有用户,只是"特殊"用户.
谢谢!
PS - 请不要将我链接到http://htmlpurifier.org/docs/enduser-customize.html …
有没有jQuery相当于原型的延迟?
我正在寻找一些会延迟脚本执行的东西,直到页面中的所有脚本都完成执行.
谢谢!
第二部分:有没有办法看到队列中是否有其他的setTimeout并且延迟执行直到它们发生之后?我在评论中看到,有时候setTimeout为0或1并不重要,因为它是不可预测的,哪个会先触发.
再次感谢!
我在下面接受的答案中找到了我使用的代码中的错误.切片调用需要在0而不是1上工作,因为在原型核心代码中,它接受额外的参数等待(0.01).最后的方法然后变成:
Function.prototype.deferFunc = function() {
var __method = this, args = Array.prototype.slice.call(arguments, 0);
return window.setTimeout(function() {
return __method.apply(__method, args);
}, 0.01);
}
Run Code Online (Sandbox Code Playgroud) javascript ×2
embed ×1
exists ×1
htmlpurifier ×1
iframe ×1
jquery ×1
mysql ×1
object ×1
prototypejs ×1
truncate ×1