小编Tos*_*dam的帖子

对PHP脚本进行更改以作为Perl脚本运行

我有一个PHP脚本,用于分隔电子邮件的标题和文本.我想将它转换为Perl脚本,以便将电子邮件作为用户的输入文件.以下是PHP脚本:

#!/usr/bin/php
<?php  
//debug  
#ini_set ("display_errors", "1");  
#error_reporting(E_ALL);  

//include email parser  
require_once('/path/to/class/rfc822_addresses.php');  
require_once('/path/to/class/mime_parser.php');  

// read email in from stdin  
$fd = fopen(ARGV[0], "r");  
$email = "";  
while (!feof($fd)) {  
    $email .= fread($fd, 1024);  
}  
fclose($fd);  

//create the email parser class  
$mime=new mime_parser_class;  
$mime->ignore_syntax_errors = 1;  
$parameters=array(  
    'Data'=>$email,  
);  

$mime->Decode($parameters, $decoded);  

//---------------------- GET EMAIL HEADER INFO -----------------------//  

//get the name and email of the sender  
$fromName = $decoded[0]['ExtractedAddresses']['from:'][0]['name'];  
$fromEmail = $decoded[0]['ExtractedAddresses']['from:'][0]['address'];  

//get the name and email of the recipient  
$toEmail = …
Run Code Online (Sandbox Code Playgroud)

php perl

1
推荐指数
1
解决办法
355
查看次数

为什么不是string.Replace按我的预期工作?

我正在编写c#代码来替换文件中的某些单词.我写的2行演示简单代码不起作用.没有错误,Console.WriteLine也提供正确的输出.

string strFileContent = File.ReadAllText(@"C:\Users\toshal\Documents\TCS\stop_words.txt");
Console.WriteLine("strfilecontent" + strFileContent);
strFileContent = strFileContent.Replace("actually" , " ");
Run Code Online (Sandbox Code Playgroud)

字符串"实际"未在文件中被替换.这可能是什么问题?

c# string replace

0
推荐指数
2
解决办法
272
查看次数

标签 统计

c# ×1

perl ×1

php ×1

replace ×1

string ×1