我有这个功能:
public function post(){
try{
$con = connectDB();
$sth = $con->prepare('SELECT * FROM posts');
$sth->execute();
$posts = $sth->fetchAll();
foreach($posts as $post){ ?>
<div>
<h2><?php echo $post['title']; ?></h2>
<p>
<?php echo $post['content']; ?>
</p>
<h6><?php echo $post['category']; ?></h6>
</div>
<?php }
}catch(PDOException $e){echo $e->getMessage();}
}
我希望使用我的其他函数将此函数的返回值存储在我的数据库中:
$page = new PageModel();
$post = new PostModel();
$page->addPage('Blog',$post->post());
但是这个没有用。有人可以告诉我什么是错的,如果可能的话,建议最简单,可能的方式吗?谢谢!
答案 0 :(得分:0)
返回要从其他区域检索的值
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4475:topUpRequest xmlns:ns4475="http://tempuri.org">
<item>
<name xsi:type="xsd:string">serviceName</name>
<value xsi:type="xsd:string">01</value>
</item>
<item>
<name xsi:type="xsd:string">sourceMsisdn</name>
<value xsi:type="xsd:string">0892929292</value>
</item>
<item>
<name xsi:type="xsd:string">pin</name>
<value xsi:type="xsd:string">12323</value>
</item>
<item>
<name xsi:type="xsd:string">destMsisdn</name>
<value xsi:type="xsd:string">08289320830</value>
</item>
<item>
<name xsi:type="xsd:string">amount</name>
<value xsi:type="xsd:string">20000</value>
</item>
<item>
<name xsi:type="xsd:string">amount</name>
<value xsi:type="xsd:string">20000</value>
</item>
<item>
<name xsi:type="xsd:string">terminalID</name>
<value xsi:type="xsd:string">AN-32</value>
</item>
<item>
<name xsi:type="xsd:string">sourceRefID</name>
<value xsi:type="xsd:string">AN-32</value>
</item>
</ns4475:topUpRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>