我想要来自 Lorem Ipsum 的随机文本所以我可以在生成网页时使用它。我找不到执行此操作的任何 PHP 函数,我想知道网站上是否有任何公开可用的库或 API 可用于获取一些随机文本?
最佳答案
$content = file_get_contents('http://loripsum.net/api');
this page 右下角的文档:
Just do a GET request on loripsum.net/api, to get some placeholder text. You can add extra parameters to specify the output you're going to get. Say, you need 10 short paragraphs with headings, use http://loripsum.net/api/10/short/headers. All of the possible parameters are:
- (integer) - The number of paragraphs to generate.
- short, medium, long, verylong - The average length of a paragraph.
- decorate - Add bold, italic and marked text.
- link - Add links.
- ul - Add unordered lists.
- ol - Add numbered lists.
- dl - Add description lists.
- bq - Add blockquotes.
- code - Add code samples.
- headers - Add headers.
- allcaps - Use ALL CAPS.
- prude - Prude version.
- plaintext - Return plain text, no HTML.
关于php - 如何从 PHP 中的 lorem Ipsum 获取随机文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20633310/