javascript和php元素没有';nt工作
我想在脚本中包含一个php元素。你有什么想法吗,可能吗javascript和php元素没有';nt工作,javascript,php,Javascript,Php,我想在脚本中包含一个php元素。你有什么想法吗,可能吗 fileFieldImageCkeditor调用CkEditor 传统知识 //html+=''; html+= 我的职能: public static function fileFieldImageCkEditor($name, $value = null, $width = null, $height = null) { if (is_null($height)) { $height = '250'; } if (
fileFieldImageCkeditor
调用CkEditor
传统知识
//html+='';
html+=
我的职能:
public static function fileFieldImageCkEditor($name, $value = null, $width = null, $height = null) {
if (is_null($height)) {
$height = '250';
}
if (is_null($width)) {
$width = '250';
}
$field = '<textarea name="' . HTML::output($name) . '" /></textarea>';
$field .= '<script>
CKEDITOR.replace(\'' . HTML::output($name) . '\',
{
width : '. $width .',
height : ' . $height . ',
filebrowserBrowseUrl :"' . OSCOM::link('Shop/ext/elFinder-master/elfinder-cke.html') . '",
});
</script>';
return $field;
}
公共静态函数fileFieldImageCkEditor($name、$value=null、$width=null、$height=null){
如果(为空($height)){
$height='250';
}
如果(为空($width)){
$width='250';
}
$field='';
$field.='
CKEDITOR.replace(\''.HTML::output($name)。'\',
{
宽度:'.$width',
高度:‘.$height’,
filebrowserBrowseUrl:“'.OSCOM::link('Shop/ext/elFinder master/elFinder cke.html')”,
});
';
返回$field;
}
它应该可以工作。只要准备好调试,以防单引号与双引号不匹配
您需要仔细检查代码,这样才能正常工作。你的第二行没有引号,为什么?
此外,如果分号出现问题(可能性很小),请改用PHP\u EOPL。不要看到任何其他内容,因为您提供的内容很少。。。我要说的是,用单引号或双引号将标签插入包起来,并希望得到最好的结果。@creditablehat;蒂克。我试过“”,没用。我在上面插入了函数是的,我明白了。您的函数输出混合的单引号和双引号,因此只需将其放在其中一个引号中,就会导致无效的javascript。可悲的是,为了使这项工作正常进行,您将不得不进行一些报价争论。@难以置信,您的确切意思是什么!引述争论。你有一个例子吗?这将是基地的尝试!
public static function fileFieldImageCkEditor($name, $value = null, $width = null, $height = null) {
if (is_null($height)) {
$height = '250';
}
if (is_null($width)) {
$width = '250';
}
$field = '<textarea name="' . HTML::output($name) . '" /></textarea>';
$field .= '<script>
CKEDITOR.replace(\'' . HTML::output($name) . '\',
{
width : '. $width .',
height : ' . $height . ',
filebrowserBrowseUrl :"' . OSCOM::link('Shop/ext/elFinder-master/elfinder-cke.html') . '",
});
</script>';
return $field;
}