mp\_str\_len($str)
:返回一個(gè)字符串的長度
$str = "hello world";
echo mp\_str\_len($str);
//輸出11
mp\_str\_tolower($str)
:將一個(gè)字符串轉(zhuǎn)換為小寫
$str = "Hello World";
echo mp\_str\_tolower($str);
//輸出hello world
mp\_str\_toupper($str)
:將一個(gè)字符串轉(zhuǎn)換為大寫
$str = "hello world";
echo mp\_str\_toupper($str);
//輸出HELLO WORLD
mp\_array\_push($arr, $value)
:將一個(gè)元素壓入數(shù)組的末尾
$arr = array(1, 2, 3);
mp\_array\_push($arr, 4);
print\_r($arr);
//輸出Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
mp\_array\_pop($arr)
:彈出數(shù)組末尾的元素
$arr = array(1, 2, 3);
mp\_array\_pop($arr);
print\_r($arr);
//輸出Array ( [0] => 1 [1] => 2 )
mp\_file\_exists($filename)
:判斷一個(gè)文件是否存在
$filename = "test.txt";
if(mp\_file\_exists($filename)) {
echo "文件存在";
}
mp\_file\_read($filename)
:讀取一個(gè)文件的內(nèi)容
$filename = "test.txt";
$content = mp\_file\_read($filename);
echo $content;
mp\_http\_get($url, $params = array())
:發(fā)送一個(gè)GET請(qǐng)求
$url = "http://www.example.com/api.php";
$params = array("id" => 1, "name" => "test");
$response = mp\_http\_get($url, $params);
echo $response;
mp\_http\_post($url, $params = array())
:發(fā)送一個(gè)POST請(qǐng)求
$url = "http://www.example.com/api.php";
$params = array("id" => 1, "name" => "test");
$response = mp\_http\_post($url, $params);
echo $response;