需把一简单php代码转为asp.net2.0或更高版的代码解决思路
程序员文章站
2022-04-11 13:41:28
...
需把一简单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转换为c++,使用Hiphop for php
------解决方案--------------------
asp 早忘光了,.net就更别提了
虽然会点PHP
下面的是全部源码,没有几行,主要是没有学过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转换为c++,使用Hiphop for php
------解决方案--------------------
asp 早忘光了,.net就更别提了
虽然会点PHP
相关文章
相关视频
上一篇: php加密和解密_PHP教程