<?php
class Api{
private $token='';
public function __construct($token){
$this->token=$token;
}
function call(array $datas=null,$bool=true){
$url = "
https://api.telegra.ph/createPage?access_token=".$this->token."&title=Sample&author_name=lol&content=".$datas."&return_content=".$bool;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$datas);
$res = curl_exec($ch);
return json_decode($res);
}
function newpage(){
return $this->call([
"tag"=>"p",
"children"=>["Hello,+world!"]
]);
}
}
как могу внутри функции сделать объекты?
[{"tag":"p","children":["Hello,+world!"],{"a":"b"}}] пример такой