首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wordpress自动投稿

问Wordpress自动投稿
EN

Stack Overflow用户
提问于 2016-05-25 22:40:58
回答 1查看 305关注 0票数 0

嗨,我找到了这个脚本,当我使用普通的charcter时,它可以工作,但是当我尝试插入一些特殊的字符不工作时,我尝试了json逃脱,没有运气,有人能帮我什么问题吗?获得误差

Parse :语法错误,第20行中/var/www/html/autopost.php中意外的'http‘(T_STRING)

代码语言:javascript
复制
<?php


require( 'wp-load.php' );
function simpleImportPost($title,$import_id,$content){
// Create post object
$my_post = array();
$my_post['post_title'] = $title;
$my_post['import_id']=$import_id;
$mypost['comment_status'] = 'closed';//I'll set all closed
$my_post['post_content'] = $content;
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_category'] = array(0);
// Insert the post into the database
return wp_insert_post( $my_post );
}

$ch_name="Live_tv_1";
simpleImportPost("$ch_name",35,"<iframe src="http://site.xxx/jwplayer_6/elchourouk.html" style="width: 640px; height: 480px" scrolling="no" frameborder=0 ALLOWTRANSPARENCY="true" overflow:hidden; ></iframe>");


?>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-25 22:45:30

你注意到了吗

代码语言:javascript
复制
simpleImportPost("$ch_name",35,"<iframe src="http://site.xxx/jwplayer_6/elchourouk.html" style="width: 640px; height: 480px" scrolling="no" frameborder=0 ALLOWTRANSPARENCY="true" overflow:hidden; ></iframe>");

包括许多连这里的显示都不能正确解析的"?

当您想在其他引号中嵌入引号时,可以使用不同的引号(' vs "),或者用反斜杠(\)转义它们,例如:

代码语言:javascript
复制
simpleImportPost("$ch_name",35,"<iframe src='http://site.xxx/jwplayer_6/elchourouk.html' style='width: 640px; height: 480px' scrolling='no' frameborder=0 ALLOWTRANSPARENCY='true' overflow:hidden; ></iframe>");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37448813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档