English 中文(简体)
Remove 
char from imapmail Eduard
原标题:Remove 
 char from imap mail extract

我正试图利用PHP IMAP图书馆的“密码>imap()”功能从谷歌中抽出一个邮件,我想使用<代码>前_match(打电话给我的邮件内容,但我有一个奇怪的问题,即我有曲解的断线,改变了正常的<代码>preg_match()。

More details: I have in my markup something like that:

<TABLE CELLPADDING=5 RULES=GROUPS FRAME=BOX>

<THEAD>
<TR> <TH>Résumé points de classement</TH>       <TH>Extérieur</TH>            <TH>Domicile</TH> </TR>
</THEAD>

<TBODY>
<TR> <TD>Équipe</TD>                      <TD>Milan</TD>         <TD>Arsenal</TD> </TR>

<TR> <TD>Performance du match</TD>         <TD>0</TD>  <TD>19</TD> </TR>
<TR> <TD>Étoiles équipe</TD>         <TD>0</TD>   <TD>0</TD> </TR>
<TR> <TD>Points totaux</TD>              <TD>3195</TD>       <TD>3273</TD> </TR>

<TR> <TD>Niveau actuel</TD>       <TD>22</TD>   <TD>22</TD> </TR>
<TR> <TD>Points pour le prochain niveau</TD> <TD>5</TD>    <TD>127</TD> </TR>
</TBODY>

</TABLE>

我正在执行这一法典,以摘录如下机构:

<?php
// $message is the previous markup.
$str = substr($message, 321, 10);
var_dump($str);
$str = preg_replace("/&#10;/i","",$str);
var_dump($str);
?>

该法典的产出是:

<pre class= xdebug-var-dump  dir= ltr ><small>string</small> <font color= #cc0000 > 
&#10;
&#10;&amp;lt;TABLE </font> <i>(length=13)</i>
</pre>
<pre class= xdebug-var-dump  dir= ltr ><small>string</small> <font color= #cc0000 > 
&#10;
&#10;&amp;lt;TABLE </font> <i>(length=13)</i>
</pre>

And the extracted value is an empty array... After further investigation i discovered through a var_dump() of my source string that there is a at the end of each line.
I have no clue of what this html char code is and how to remove it.

最佳回答

第一件事是,我假定,你已经走过了不快的头盔。

假设你在UTF8 charset,而不是ISO-8859-1或ISO-8859-15 charset重新工作,你可以尝试

utf8_encode($string);

EDIT Whoops... to remove or replace the char you can use

preg_replace( /&#10/ , <alt> ,$string);

有理由认为你具有替代性质。 你们可以做任何事情来取代它。

preg_replace( /&#10/ ,  ,$string);

你们也可以通过预选管理一个阵列。

$string = $myFile;
$search = array( /&#10/ , /sec/ );
$replace = array(  , <alt> );
preg_replace($search,$replace,$string);

这也可能与你有关。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签