0
$name = substr($name, 0, -strlen($ext)) . "_medium." . end(explode('.',$name));

上面的代码报告了标准警告,小脚本如下:

  function medium($name) {
    $ext = strrchr($name, '.');
    if($ext !== false) {
        $name = substr($name, 0, -strlen($ext)) . "_medium." . end(explode('.',$name));
    }
    return $name;
  }

  function thumb($name) {
    $ext = strrchr($name, '.');
    if($ext !== false) {
        $name = substr($name, 0, -strlen($ext)) . "_thumb." . end(explode('.',$name));
    }
    return $name;
  }

  function name_remove($name) {
    $name = str_replace("_medium", "", $name);
    $name = str_replace("_thumb", "", $name);
    return $name;
  }

我该如何解决这个警告?需要帮忙 :)

4

2 回答 2

0
$blocks = explode('.',$name);
$name = substr($name, 0, -strlen($ext)) . "_medium." . end($blocks);

但是为什么不使用pathinfo()

于 2013-05-22T17:20:26.800 回答
0

将您的错误报告更改为30719.

于 2013-05-22T17:20:28.563 回答