PHP 中是否有一种方法来计算字符串给定宽度和给定行距的线条?
For example, if I have this text:
Sed eget lorem lorem. Pellentesque tristique, quam vel fringilla porttitor,
neque elit suscipit nisl, id posuere magna libero congue ante.
= 2 lines
Sed eget lorem lorem. Pellentesque
tristique, quam vel fringilla
porttitor, neque elit suscipit nisl,
id posuere magna libero congue ante.
= 4 lines because the width is not the same
Edit:
My question was not clear.
As Jason McCreary said, I want to create a formula (based on font-size, string length, line-height) with PHP that will get me close.
如果有人能派我走正确方向 去做我很感激的事 因为我试图创造那个神奇的公式 却毫无结果
我无法在页面中使用 JavaScript 。
谢谢!