我尝试使用以下link
中的PHP代码我尝试了以下代码,但它只显示了文字。我怎样才能找到特定元素,例如编号和子弹,强调句子......?:
使用chr()函数解决我的问题有什么技巧吗?
<?php
function content($file){
$data_array = explode(chr(0x0D),fread(fopen($file, "r"), filesize($file)));
$data_text = "";
foreach($data_array as $data_line){
if (strpos($data_line, chr(0x00) !== false)||(strlen($data_line)==0))
{} else {if(chr(0) || chr(149)) {
$data_text .="<br /> ";
$data_text .= preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/","",$data_line);
}
}
}
$data_text = str_replace('Responsibilities','<strong>'.Responsibilities.': </strong>',$data_text);
$data_text = str_replace('Requirements','<strong>'.Requirements.': </strong>',$data_text);
return $data_text;
}
$destination = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']);
$destination.= "upload/";
$maxsize = 5120000;
if (isset($_GET['upload'])) {
if($_FILES['userfile']['name'] && $_FILES['userfile']['size'] < $maxsize) {
if(move_uploaded_file($_FILES['userfile']['tmp_name'], "$destination/".$_FILES['userfile']['name'])){
$file = $destination."/".$_FILES['userfile']['name'];
$data = content($file);
echo $data;
}
}
}else{
echo "<form enctype='multipart/form-data' method='post' action='index.php?upload'>
<input name='userfile' type='file'>
<input value='Upload' name='submit' type='submit'>
</form>";
}
?>