{"id":12888,"date":"2022-11-11T13:54:07","date_gmt":"2022-11-11T11:54:07","guid":{"rendered":"https:\/\/www.beseit.net\/?p=12888"},"modified":"2022-11-11T19:15:29","modified_gmt":"2022-11-11T17:15:29","slug":"php-transforma-un-fitxer-en-una-variable","status":"publish","type":"post","link":"http:\/\/www.beseit.net\/?p=12888","title":{"rendered":"PHP Transforma un fitxer en una variable"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.beseit.net\/wp-content\/uploads\/2022\/11\/111122_1224_PHPTransfor1.png\" alt=\"\" \/><\/p>\n<p>[php]<\/p>\n<p>&lt;?php<br \/>\n$wordlist=&quot;&quot;;<br \/>\n$myfile = fopen(&#8216;pons_ger.txt&#8217;, &#8216;r&#8217;) or die(&#8216;Unable to open file!&#8217;);\/\/ tot el fitxer en una linia sense cr lf<\/p>\n<p>\/\/echo bin2hex($wordlist) . &quot;&lt;br \/&gt;&quot;;<br \/>\n\/\/$search_string = &quot;abbaubar&quot;;<\/p>\n<p>while(!feof($myfile)) {<br \/>\n \t$wordlist= $wordlist. fgets($myfile).&#8217;\u00b7&#8217;; \/\/afegeix indicador de CRLF<br \/>\n\t\/\/$wordlist= str_replace(&quot;$search_string&quot;, &quot;.|$search_string&quot;,$wordlist);<br \/>\n\t echo &#8216;&lt;br&gt;&#8217;.$wordlist. &#8216;&lt;br&gt;&#8217;;<br \/>\n\t}<br \/>\necho &quot;&lt;br&gt;&quot;. $wordlist.&quot;&lt;br&gt;&quot;;<br \/>\n ?&gt;<\/p>\n<p>[\/php]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[php] &lt;?php $wordlist=&quot;&quot;; $myfile = fopen(&#8216;pons_ger.txt&#8217;, &#8216;r&#8217;) or die(&#8216;Unable to open file!&#8217;);\/\/ tot el fitxer en una linia sense cr lf \/\/echo bin2hex($wordlist) . &quot;&lt;br \/&gt;&quot;; \/\/$search_string = &quot;abbaubar&quot;; while(!feof($myfile)) { $wordlist= $wordlist. fgets($myfile).&#8217;\u00b7&#8217;; \/\/afegeix indicador de CRLF \/\/$wordlist= str_replace(&quot;$search_string&quot;, &hellip; <a href=\"http:\/\/www.beseit.net\/?p=12888\">Continua llegint <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-12888","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/12888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12888"}],"version-history":[{"count":17,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/12888\/revisions"}],"predecessor-version":[{"id":12930,"href":"http:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/12888\/revisions\/12930"}],"wp:attachment":[{"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12888"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}