Fputcsv How to force all data to double quotes

Source: Internet
Author: User
Fputcsv How to force all data to be enclosed in double quotes
Fputcsv How to force all data to be enclosed in double quotes

------Solution--------------------
That's what the document says,

PHP Code

fputcsv — Format lines into CSV and write to file pointer instructions Format to CSV format and write to the file specified by handle. Returns the length of the written string, or FALSE on error. The optional delimiter parameter sets the field delimiter (only one character is allowed). The default is a comma:,. The optional enclosure parameter sets the field wrap character (only one character is allowed). The default is double quotes: ". Example # 1 fputcsv () Example <!-? Php $ list = array ('aaa, bbb, ccc, dddd', '123,456,789', '" aaa "," bbb "'); $ fp = fopen ('file.csv', 'w'); foreach ($ list as $ line) {fputcsv ($ fp, split (',', $ line));} fclose ($ fp);?- -> Note: When reading files created on or created by a Macintosh computer, if PHP does not recognize line endings correctly, enabling the runtime configuration option auto_detect_line_endings may solve this problem. See fgetcsv (). <Div class = "clear"> <div class = "share layui-clear bdsharebuttonbox bdshare-button-style0-16" data-bd-bind = "1589769021201"> <li> <a href = "javascript :;" data-cmd = " weixin "class =" wechat "> <i class =" layui-icon ">  </ i> WeChat </a> </ li> <li> <a href =" javascript :; "data-cmd =" more "class =" share-btn "> <i class =" layui-icon ">  </ i> Share </a> </ li> </ div> <img src =" / static / images / article_wechat.jpg ? 1 "style =" margin-top: 30px; "alt =" phpChinese net latest course QR code "> <div class =" tags layui-clear "> <li> Relevant tags: <a href =" / search ? word = fputcsv "targe t = "_ blank"> fputcsv </a> <a href="/search?word=quot" target="_blank"> quot </a> <a href = "/ search? word = delimiter" target = "_ blank "> delimiter </a> <a href="/search?word=enclosure" target="_blank"> enclosure </a> <a href="/search?word=line" target="_blank"> line < / a> </ li> <li class = "line"> This article was originally published on php Chinese website. Please indicate the source when reprinting. Thank you for your respect! </ li> </ div> <div class = "page layui-clear"> <ul> <li> Previous: <a href="/php-weizijiaocheng-182451.html"> How to make people not direct Access to the files under the server </a> </ li> <li> Next: <a href="/php-weizijiaocheng-182454.html"> 200 points: PayPal collection, what should be paid attention to in security? , Thank you </a> </ li> </ ul> </ div> </ div> <p class = "article-relative-header"> Related articles </ p> <p class = "article-relative-header "> Related videos </ p> <hr class =" layui-clear "> <ul class =" article-relative-ul "> <li> <span class =" layui-badge-dots "> </ span> < a class = "relevant" href = "/ php-weizijiaocheng-375150.html" target = "_ blank"> PHP uses curl to collect </a> </ li> <li> <span class = "layui-badge-dots" > </ span> <a class="relevant" href="/php-weizijiaocheng-375152.html" target="_blank"> php object-oriented essentials </a> </ li> <li> <span class = " layui-badge-dots "> </ span> <a class="relevant" href="/php-weizijiaocheng-375395.html" target="_blank"> php function </a> </ li> <li> < span class = "layui-badge-dots"> </ span> <a class = "relevant" href = "/ php-weizijiaocheng-375402.html" target = " _blank "> Introduction to PHP modifiers </a> </ li> <li> <span class =" layui-badge-dots "> </ span> <a class =" relevant "href =" // php-weizijiaocheng- 182452.html "> fputcsv how to force all data to be double quoted </a> </ li> </ ul> <ul class =" article-relative-ul "> <li> <span class =" layui-badge -dots "> </ span> <a class="relevant" href="/code/912.html" target="_blank" title=".E[attr~="value"]selector"> .E [ attr ~ = "value"] Selector </a> </ li> <li> <span class = "layui-badge-dots"> </ span> <a class = "relevant" href = "/ code / 915 .html "target =" _ blank "title =" E [attr ^ = "value"] selector "> E [attr ^ =" value "] selector </a> </ li> <li> <span class = "layui-badge-dots"> </ span> <a class="relevant" href="/code/916.html" target="_blank" title="E[attr$="value"]selector"> E [attr $ = "value"] selector </a> </ li> <li> <span class = "layui-badge-dots"> </ span> <a class = "relevant" href = "/ code /917.html "target =" _ blank "title =" E [attr * = "value"] selector "> E [attr * =" value "] selector </a> </ li> <li> <span class = "layui-badge-dots"> </ span> <a class = "relevant" href = "/ code / 918.html" target = " _blank "title =" E [attr | = "value"] selector "> E [attr | =" value "] selector </a> </ li> </ ul> <div class =" layui-clear " > </ div>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.