1

ASP has a MeasureString function that returns the width, in pixels, of a string given a certain font/size. Is this possible in PHP?

4

2 回答 2

5

是的,使用 GD 库。

http://www.php.net/manual/en/function.imagettfbbox.php

这是用于在图像上呈现的文本。文本宽度因浏览器、操作系统而有所不同(字体平滑、不同的渲染)

于 2010-07-01T21:12:01.987 回答
1

如果您安装了 GD ,也许您可​​以使用imagettfbbox功能

于 2010-07-01T21:12:08.680 回答