Home  >  Article  >  Backend Development  >  需把一简单php代码转为asp.net2.0或更高版的代码解决思路

需把一简单php代码转为asp.net2.0或更高版的代码解决思路

WBOY
WBOYOriginal
2016-06-13 13:43:31989browse

需把一简单php代码转为asp.net2.0或更高版的代码
下面的是全部源码,没有几行,主要是没有学过php,对于学过的应不是什么问题
$imageDirectory   =   $_GET[ 'seed '];
if(!is_dir( "./images/uploaded/$imageDirectory "))   mkdir( "./images/uploaded/ ",   0755);
$dotLocation   =   strrpos($_FILES[ 'Filedata '][ 'name '],   '. ');
$newFileName   =sanitizeText(substr($_FILES[ 'Filedata '][ 'name '],   0,   $dotLocation))   .   substr($_FILES[ 'Filedata '][ 'name '],   $dotLocation);

move_uploaded_file($_FILES[ 'Filedata '][ 'tmp_name '],   "./images/uploaded/ "   .   $newFileName);
chmod( "./images/uploaded/ ".$_FILES[ 'Filedata '][ 'name '],   0777);

function   sanitizeText($text)
{
$title   =   strip_tags($text);

$title   =   preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])| ',   '---$1--- ',   $title);

$title   =   str_replace( '% ',   ' ',   $title);

$title   =   preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---| ',   '%$1 ',   $title);

$title   =   strtolower($title);
$title   =   preg_replace( '|/+| ',   '- ',   $title);
$title   =   preg_replace( '/&.+?;/ ',   ' ',   $title);   //   kill   entities
$title   =   preg_replace( '/[^%a-z0-9   _-]/ ',   ' ',   $title);
$title   =   preg_replace( '/\s+/ ',   '- ',   $title);
$title   =   preg_replace( '|-+| ',   '- ',   $title);
$title   =   trim($title,   '- ');

return   $title;
}
?>

------解决方案--------------------
string imageDirectory = resquest.queryString('seed ');
------解决方案--------------------

探讨
下面的是全部源码,没有几行,主要是没有学过php,对于学过的应不是什么问题
$imageDirectory = $_GET[ 'seed '];
if(!is_dir( "./images/uploaded/$imageDirectory ")) mkdir( "./images/uploaded/ ", 0755);
$dotLocation = st……

------解决方案--------------------
好像不行,不过你可以把PHP转换为c++,使用Hiphop for php
------解决方案--------------------
asp 早忘光了,.net就更别提了

虽然会点PHP
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn