PHP code example of ponponumi / link_create
1. Go to this page and download the library: Download ponponumi/link_create library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ponponumi / link_create example snippets
use Ponponumi\LinkCreate\Web;
$text = "私は、PHPのサーバーサイド開発の方が好きかな #プログラミング #PHP";
// オプション
$option = [
"hashtagUrl" => 'http://localhost:2230/search.php?tag={hashtag}',
];
// aタグを生成
$a = Web::create($text,$option);
// 出力結果
/*
私は、PHPのサーバーサイド開発の方が好きかな
<a href="http://localhost:2230/search.php?tag=%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0">#プログラミング</a>
<a href="http://localhost:2230/search.php?tag=PHP">#PHP</a>
*/
use Ponponumi\LinkCreate\Core;
$text = "メールアドレスは [email protected] です!";
// オプション
$option = [
"email",
];
// リストを生成
$hit = Core::get($text,$option);
// 出力結果
/*
array(1) {
[0]=>
array(2) {
["pos"]=>
int(9)
["value"]=>
string(16) "[email protected] "
}
}
*/
use Ponponumi\LinkCreate\Core;
$text = "メールアドレスは [email protected] です!";
// オプション
$option = [
"email",
];
// リストを生成
$hit = Core::arrangement($text,$option);
// 出力結果
/*
array(3) {
[0]=>
array(2) {
["text"]=>
string(25) "メールアドレスは "
["link"]=>
NULL
}
[1]=>
array(2) {
["text"]=>
string(16) "[email protected] "
["link"]=>
string(16) "[email protected] "
}
[2]=>
array(2) {
["text"]=>
string(10) " です!"
["link"]=>
NULL
}
}
*/