需把一簡單php代碼轉為asp.net2.0或更高版的代碼解決思路
來源:互聯網
上載者:User
需把一簡單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