PHP

PHP 代码截图生成器

不必离开 Mac,就能把 PHP 代码片段变成值得分享的图片。

现在的 PHP 和大多数人印象里的 PHP 完全不是一回事,这正是把它发成图片而不是用文字描述的好理由。

Codeshot 会根据你粘贴的代码识别 PHP,不存在选错语言的问题。下面是同一段代码在内置 30 款主题中的三款下的效果,由应用自身的样式表渲染。

<?php

final class Snapshot
{
    public function __construct(
        private string $code,
        private string $theme = 'xcode',
    ) {}

    public function export(string $path, int $scale = 2): bool
    {
        return Renderer::render($this->code, $this->theme)->save($path, $scale);
    }
}
Atom One · 深色
<?php

final class Snapshot
{
    public function __construct(
        private string $code,
        private string $theme = 'xcode',
    ) {}

    public function export(string $path, int $scale = 2): bool
    {
        return Renderer::render($this->code, $this->theme)->save($path, $scale);
    }
}
Edge · 深色
<?php

final class Snapshot
{
    public function __construct(
        private string $code,
        private string $theme = 'xcode',
    ) {}

    public function export(string $path, int $scale = 2): bool
    {
        return Renderer::render($this->code, $this->theme)->save($path, $scale);
    }
}
GitHub · 深色

为 PHP 选择主题

类型化属性和构造器提升让片段很紧凑。把开头标签留在画面里,语言就一目了然了。

把尺寸定对

让图片随内容自适应,或锁定一个比例——1:1、4:3、3:2、16:9、9:16、2:3 或 3:4——然后以 1×、2× 或 3× 导出,在 Retina 屏上依然清晰。用 C 直接复制到剪贴板,或用 S 保存。

查看全部 30 款主题对比,或阅读完整流程

为 PHP 以及另外 59 种语言打造

一切都在你的 Mac 上完成,代码不会外传。

下载 macOS 版