2020年6月

我一般在centos下挂载windows磁盘都是这么操作的

mount -t cifs -o username=administrator,password=123 //192.168.56.104/d$/code/fhx /code/fhx

问题列表以及处理方案

  • mount error(13): Permission denied
[root@localhost code]# mount -t cifs -o username=administrator,password=123 //192.168.56.104/d$/code/fhx /code/fhx
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

最后还是解决了

windows10逼着我更新, 更新完了后无法通过卷标的方式去访问共享了, 虽然共享列表还在, 但是不能访问了, 重新添加访问目录就可以使用了

Listen 80
<VirtualHost *:80>
        DocumentRoot "D:\code\www"
        FcgidInitialEnv PHPRC "D:/server/web/server/php"
        AddHandler fcgid-script .php
        FcgidWrapper "D:/server/web/server/php/php-cgi.exe" .php
      <Directory "D:\code\www">
          Options FollowSymLinks ExecCGI
          AllowOverride All
          Order allow,deny
          Allow from all
         Require all granted
      </Directory>
    ProxyPass /hb/ http://192.168.56.103:9501/
    ProxyPass /80/ http://127.0.0.1:81/
</VirtualHost>

列出安装的包并筛选

composer show -i | grep hyperf

查看全局安装的包

composer global show

查看安装的包

composer show

composer 安装报内存不足

执行安装

php -d memory_limit=-1 `which composer` install -vvv

执行更新

php -d memory_limit=-1 `which composer` update -vvv

九宫格切割以及加文字方法

!defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
define('CACHE_PATH', BASE_PATH . '/runtime/cache');
define('RESOURCE_PATH', BASE_PATH . '/resource');

// 九宫格切图且添加文字
imageSlicing9($imgPath, $fonts = [], $fontPath = null)
{
    list($width, $height) = getimagesize($imgPath);
    $source = imagecreatefromjpeg($imgPath);

    $width = $width - $width % 3;
    $height = $height - $height % 3;

    $baseWidth = $width / 3;
    $baseHeight = $height / 3;;

    $imgPathMd5 = md5($imgPath);
    $results = [];
    foreach ([
                 [0, 0],
                 [$baseWidth, 0],
                 [$baseWidth * 2, 0],

                 [0, $baseHeight],
                 [$baseWidth, $baseHeight],
                 [$baseWidth * 2, $baseHeight],

                 [0, $baseHeight * 2],
                 [$baseWidth, $baseHeight * 2],
                 [$baseWidth * 2, $baseHeight * 2],
             ] as $key => $item) {
        $thumb = ImageCreateTrueColor($baseWidth, $baseHeight);
        imagecopyresized($thumb, $source, 0, 0, $item[0], $item[1], $baseWidth, $baseHeight, $baseWidth, $baseHeight);

        if (!empty($fonts[$key])) {

            $fontCount = mb_strlen($fonts[$key], 'utf-8');
            $black = imagecolorallocate($thumb, 0, 0, 0);//字体颜色 RGB
            $fontSize = 12;   //字体大小

            $circleSize = 0; //旋转角度
            $left = 5;
            $right = 5;
            $fonttIndex = 0;
            $fontList = [];
            $fonttRowWidth = $baseWidth - $left - $right;
            $fontList[$fonttIndex] = '';
            $fontListWidth[$fonttIndex] = 0;
            $fonttHeight = $fontSize;
            for ($iii = 0; $iii < $fontCount; $iii++) {
                $fontt = mb_substr($fonts[$key], $iii, 1, 'utf-8');
                $pos = imagettfbbox($fontSize, 0, $fontPath, $fontt);
                $fonttWidth = $pos[2] - $pos[0];
                $fonttHeight = $pos[3] - $pos[5];
                // 计算剩余宽度, 如果够, 那么就挤进去, 否则下一排
                if (($fonttRowWidth = $fonttRowWidth - $fonttWidth) > 0) {
                    $fontList[$fonttIndex] .= $fontt;
                    $fontListWidth[$fonttIndex] += $fonttWidth;
                } else {
                    $fonttRowWidth = $baseWidth - $left - $right - $fonttWidth;
                    $fonttIndex++;
                    $fontList[$fonttIndex] = $fontt;
                    $fontListWidth[$fonttIndex] = $fonttWidth;
                }
            }
            $top = $baseHeight - ($fonttHeight + 5) * count($fontList) + 5;
            if ($top < 0) {
                $top = 10;
            }
            if (count($fontList) == 1) {
                $left = intval(($baseWidth - $fontListWidth[0]) / 2);
            }
            foreach ($fontList as $fontvalue) {
                imagefttext($thumb, $fontSize, $circleSize, $left, $top, $black, $fontPath, $fontvalue);
                $top = $top + $fonttHeight + 5;
            }


            /*
            $widthFonts = intval($baseWidth / ($fontSize * 1.4)); // 一排显示的文字数量
            $rows = ceil($fontCount / $widthFonts);
            $top = $baseHeight - ($fontSize + 5) * $rows;
            if ($top < 0) {
                $top = 0;
            }
            for ($ii = 1; $ii <= $rows; $ii++) {
                // $fontItem = substr($fonts[$key], ($ii - 1) * $widthFonts, $widthFonts);
                $fontItem = mb_substr($fonts[$key], ($ii - 1) * $widthFonts, $widthFonts, 'utf-8');
                if (!empty($fontItem)) {
                    var_dump([$left, $top, $fontItem]);
                    imagefttext($thumb, $fontSize, $circleSize, $left, $top, $black, $fontPath, $fontItem);
                }
                $top = $top + $fontSize + 5;
            }
            */
        }

        imagejpeg($thumb, $results[] = CACHE_PATH . "/" . $imgPathMd5 . "{$key}.jpg", 100);
    }
    return $results;
}

执行图片切割且加文字

$imgPath = BASE_PATH . '/runtime/cache/timg.jpg';
$fontPath = RESOURCE_PATH . '/fonts/方正黑体简体.TTF';//字体,字体文件需保存到相应文件夹下
$fonts = ["啊1","啊2","啊3","啊4","啊5","啊6","啊7","啊8","啊9",]
$pp = imageSlicing9($imgPath, $fonts, $fontPath);
var_dump($pp);