首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >插入mysql不完全值字段

问插入mysql不完全值字段
EN

Stack Overflow用户
提问于 2014-05-27 08:52:37
回答 1查看 206关注 0票数 0

我必须映射一个xml文件并将其节点插入到wordpress mysql表中。

代码语言:javascript
复制
    $postTable = $wpdb->prefix . "posts";
    $nouvelles = simplexml_load_file('annonces.xml'); 

    foreach($nouvelles->ANNONCE as $annonce) {     
    $wpdb->insert( 
            $postTable, $post_arr =array( 
        'post_author' => 1, 
        'post_date' => current_time('mysql', 1) ,
        'post_date_gmt'=>current_time('mysql', 1),
        'post_content' =>utf8_decode($annonce->TEXTE),
        'post_title'=>utf8_decode($annonce->TITRE),
        'post_excerpt'=>'',
        'post_status'=>'publish',
        'comment_status'=>'closed',
        'ping_status'=>'closed',
        'post_password'=>'',
        'post_name'=>str_replace(' ','-',utf8_decode($annonce->TITRE)),
        'to_ping'=>'',
        'pinged'=>'',
        'post_modified'=>date("M d Y H:i:s"),
        'post_modified_gmt'=>gmdate("M d Y H:i:s"),
        'post_content_filtered'=>'',
        'post_parent'=>0,
        'guid'=>Site_url().'?post_type=property&p='.$idPost,
        'menu_order'=>0,
        'post_type'=>'property',
        'post_mime_type'=>'',
        'comment_count'=>''
   ));
 }

我的文本节点在annonce.xml中是这样的:

代码语言:javascript
复制
 <TEXTE>PAVILLON TRADITIONNEL EDIFIE SUR SOUS SOL TOTAL !! Vaste salon sejour avec cheminee, grande cuisine amenagee et equipee donnant sur une veranda, 4 chambres, piscine chauffee, PRESTATIONS DE QUALITES</TEXTE>

仅在mysql posts表中

“世园会传统沙龙!”

在'post_content'字段中插入,我还有两个'ANNONCE'节点。是缓冲区溢出吗?

PS:'post_content‘字段类型为长文本,我试图在第一次迭代中退出循环,字段被完全插入,我试图增加memory_limit,将output_buffering更改为on。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-27 18:26:39

这是utf8_decode的一个问题,我把它删除了,问题就解决了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23884979

复制
相关文章

相似问题

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