0

CSVとしてエクスポートしたカスタムデータベースがあります。Wordpressデータベースの列と一致するように列とデータを再配置したので、データをインポートできました。

唯一の問題は、カスタムデータベースの列の1つにHTMLが含まれていることです。これにより、データがCSVとしてWordpressにインポートされなくなります。これを回避する方法はありますか?何百もの行のスタイルを再度変更する必要がないので、HTMLを保持する必要があります。

そもそもデータを操作できる形式にするのには時間がかかります。

ps 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 &pound;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 &amp; Introduction<br />
16:45 Professor David May<br />
17:30 Rick Chapman<br />
17:50 Nick Sturge<br />
18:30 Drinks and canap&eacute;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&#038;p=5000,0,tribe_events,,0
4

2 に答える 2

1

csvファイルでOK、置換を検索

\\に置き換える'と、ファイル内の単一引用符がエスケープされます\'

その後、交換してください

"<p>\\を使用し'<p> て、テキストフィールドを一重引用符で囲みます

その後、交換します

</p>"\\を使用し</p>' て、テキストフィールドを一重引用符で囲みます

次に、インポートしてみてください....動作するはずです

于 2012-04-11T14:39:48.947 に答える
1

キリル文字のホテルのウェブサイトでワードプレスの投稿を更新しようとすると、同じ問題が発生します。

簡単な解決策は次のとおりです。

csvファイルを編集した後、すべての\」に置き換え、ファイルを保存してメモ帳で開きます++すべての「」を検索してファイルを保存」に置き換えます。次のオプションを使用してphpmyadminをインポートできます。 ここに画像の説明を入力します

(現在の投稿を置き換える場合は、テーブルデータをファイルに置き換えるがチェックされます)最も重要なのは**列をエスケープする:\ **-これは、phpmyadminが*"行のCSV入力で無効な列数を表示しないようにするのに役立ちますX"*エラー

プロセス全体を段階的に説明します。

  1. phpmyadminからwp_postsテーブルをエクスポートします。
  2. Excelで直接開くのに問題があるので、最初にOpen Officeを開いて開いてから、Excelでコピーする必要があります。
  3. 編集が終了したら、すべての「」を「 に置き換えてから、UNICODTEXTとして保存します。
  4. メモ帳++で開き、すべてのタブをに置き換えて、UTF-8として保存します(通常のメモ帳でもこれを行う方法がわからない場合)
  5. 拡張子を.txtから.csvに手動で変更します
  6. メモ帳++で開き、すべての「」を見つけて「 に置き換えて保存します。
  7. 上記の設定でファイルをインポートします。

テストには1日かかりましたが、最終的にはこれを理解しました。最良の部分は、キリル文字でも機能することです。

于 2017-08-04T11:35:59.783 に答える