wc移植sae笔记

时间:2023-03-09 15:11:09
wc移植sae笔记

1.wc移植到sae---上传图片

①先看profile.ptl.html中的ajax代码修改functions.js中G_BASE_URL的值。在这里我先写死成->'http://2.idangou.sinaapp.com/?';

②采用的打log的方法一步一步来解决问题,代码如下:

$data = $this->s->read('idangou' , 'log.html');
$this->s->write('idangou' , 'log.html' , $data.'$this->file_temp--'.$this->file_temp.'<br/>'
.'$this->file_size--'.$this->file_size.'<br/>'
.'$this->file_type--'.$this->file_type.'<br/>'
.'$this->file_name--'.$this->file_name.'<br/>'
.'$this->file_ext--'.$this->file_ext.'<br/>'
.'$this->client_name--'.$this->client_name.'<br/>');

③在functions.inc.php中make_dir方法中,代码修改,注释为原来的,下面为自己的

(注意:$s->fileExists('idangou',$dir)中的参数$dir最后一位不能是'/')

function make_dir($dir, $mode = 0777)
{
// echo "dazhu ni mei de3 !!".$dir.'<br/>';
// $dir = rtrim($dir, '/') . '/';
// echo "dazhu ni mei de4 !!".$dir.'<br/>';
//
// if (is_dir($dir))
// {
// echo "dazhu ni mei de5 !!";
// return TRUE;
// }
//
// echo "dazhu ni mei de6 !!";
// if (! make_dir(dirname($dir), $mode))
// {
// echo "dazhu ni mei de7 !!";exit;
// return FALSE;
// }
$s = new SaeStorage();
echo "dazhu ni mei de3 !!".$dir.'<br/>';
$dir = rtrim($dir, '/');
echo "dazhu ni mei de4 !!".$dir.'<br/>'; if ($s->fileExists('idangou',$dir))
{
echo "dazhu ni mei de5 !!";
return TRUE;
} echo "dazhu ni mei de6 !!";
if (! make_dir(dirname($dir), $mode))
{
echo "dazhu ni mei de7 !!";exit;
return FALSE;
} return @mkdir($dir, $mode);
}

④记住一个调试地址:http://2.idangou.sinaapp.com/?/account/ajax/avatar_upload/

⑤最后还是未成功