我的知识记录

请问PbootCMS如何实现上传的文件使用原名称(1)

  1. 打开 \core\function\file.php,找到:
    $file_ext = strtolower(end($file)); // 获取扩展
  2. 在其下一行增加:
    $file_truename = $file[0]; // 获取文件真实名称
  3. 继续在此文件里找到:
    $file_path = $save_path . '/' . $file_type . '/' . date('Ymd') . '/' . time() . mt_rand(100000, 999999) . '.' . $file_ext;
  4. 替换成以下:
    // 如果是图片随机重命名,其他的按原文件名称 if ($file_type == 'image') {     $file_path = $save_path . '/' . $file_type . '/' . date('Ymd') . '/' . time() . mt_rand(100000, 999999) . '.' . $file_ext; } else {     $file_path = $save_path . '/' . $file_type . '/' . date('Ymd') . '/' . $file_truename . '.' . $file_ext; }

     

标签:pbootcms新手入门教程-pbootcms怎么样-pboot cms模板-pbootcms采集-pbootcms模板下载-

更新时间:2025-04-10 23:53:00

上一篇:请问pbootcms模板报错提示 PHP Warning_ Unknown_ open_basedir restriction

下一篇:请问PbootCMS挪用内容中换行符“<br>”不换行怎么办