我有一个自定义数据库,我以CSV格式导出。我重新安排了列和数据以匹配Wordpress数据库的列,因此我可以导入数据。
唯一的问题是自定义数据库中的一列包含HTML。这样就可以阻止数据以CSV格式导入Wordpress。有没有办法解决这个问题?我真的需要保留HTML,因为我不想再次重新安排数百行。
首先需要一段时间才能将数据转换为一种格式进行操作。
p.s如果我导入没有HTML列的数据,它会导入Wordpress。
以下是一个例子:
ID,post_author,post_date,post_date_gmt,post_content,post_title,post_excerpt,post_status,comment_status,ping_status,post_password,post_name,to_ping,pinged,post_modified,post_modified_gmt,post_content_filtered,post_parent,guid,menu_order,post_type,post_mime_type,comment_count
5000,1,28/02/2012 15:00,28/02/2012 15:00,"<p>Marriott Royal Hotel, College Green, Bristol<br />
<br />
We are pleased to announce the launch of the <a rel=""nofollow"" target=""_blank"" href=""http://www.inets-sw.co.uk/default.aspx?page=495"">Microelectronics iNet</a> for the South West. This £2.3 million ERDF funded project will facilitate innovation and growth across the microelectronics industry by working with businesses to transform exciting ideas into new products and services.</p>
<p>Join us for the opportunity to learn more about the iNet and to hear leading technology entrepreneur Professor David May speaking on future trends and opportunities.</p>
<p>Speaking alongside Professor May will be Rick Chapman, Director of the Microelectronics iNet and Nick Sturge, Director of the SETsquared Business Acceleration Centre in Bristol.</p>
<p>Please register by Friday 26 November.</p>
<p><a rel=""nofollow"" target=""_blank"" href=""http://www.inets-sw.co.uk/micro/events/december_200/ingenious_britain_in_action.aspx"">Further details</a> or <a target=""_blank"" rel=""nofollow"" href=""https://www.formstack.com/forms/inets-launch"">book now</a></p>
<p>About the iNets<br />
The Microelectronics iNet is a consortium of universities, commercial organisations and industry networks. The project is led by the University of the West of England, and includes the University of Bristol, STMicroelectronics, the National Microelectronics Institute and the Electronics, Sensors and Photonics KTN.<br />
<br />
Agenda<br />
16:00 Arrival<br />
16:30 Welcome & Introduction<br />
16:45 Professor David May<br />
17:30 Rick Chapman<br />
17:50 Nick Sturge<br />
18:30 Drinks and canapés</p>
<p>Get updates<br />
<a rel=""nofollow"" target=""_blank"" href=""https://www.formstack.com/forms/inets-mailing_list"">Sign up</a> to receive regular updates from the Microelectronics iNet</p>
<p>Contact Us<br />
0117 32 86690<br />
<a href=""mailto:microelectronics@inets-sw.co.uk"">microelectronics@inets-sw.co.uk</a><br />
<a rel=""nofollow"" target=""_blank"" href=""http://www.inets-sw.co.uk/"">http://www.inets-sw.co.uk/</a></p>",Microelectronics iNet Launch,,publish,closed,closed,,,,,11/04/2012 10:04,11/04/2012 10:04,,0,http://www.mediwales.com/v3/?post_type=tribe_events&p=5000,0,tribe_events,,0
答案 0 :(得分:1)
在csv文件中找到替换
将'
替换为\'
\\将转义文件中的单引号
然后 替换
带有"<p>
\\的 '<p>
将文本字段放在单引号中
然后替换
带有</p>"
\\的 </p>'
将文本字段放在单引号中
然后尝试导入....它应该工作
答案 1 :(得分:1)
嘿我在我的西里尔hotel网站上尝试更新wordpress帖子时遇到了同样的问题。
简短的解决方案是:
编辑csv文件后,将所有“替换为 \”,保存文件并使用notepad ++打开查找并替换所有“”使用“保存文件,您可以使用以下选项导入phpmyadmin: enter image description here
(如果要替换当前帖子,则检查用文件替换表数据) 最重要的是**列转义:\ ** - 这将帮助phpmyadmin不会给你 *“第X行的CSV输入中的无效列数”* 错误
以下是整个过程:
我花了一天时间进行测试,但最后我发现了这一点。最好的部分是它也适用于西里尔字符。