需把一簡單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
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.