<?php // 标题文本 $title = "我是标题"; // 数据 $data = [ ["id" => "ID", "username" => "用户名", "score" => "得分"], ["id" => 1, "username" => "给你最好的我丶", "score" => 92], ["id" => 2, "username" => "抬首轻笑", "score" => 95], ["id" => 3, "username" => "嘉恒帅比等你王者归来", "score" => 74] ]; // 字体 $font = "./msyh.ttf"; $font_size = 30; // 标题长度 $this_title_box = imagettfbbox($font_size, 0, $font, $title); $title_x_len = $this_title_box[2] - $this_title_box[0]; $title_height = 60; // 每行高度 $row_hight = $title_height - 10; $id_x_len = $username_x_len = $score_x_len = 20; foreach ($data as $key => $value) { # imagettfbbox 获取文字 4 个角的坐标 $this_id_box = imagettfbbox($font_size, 0, $font, $value["
PHP数据生成表格图片
最新推荐文章于 2023-07-10 11:02:30 发布