在html中调用php内容,可以用script src="friendlinks.php"/script然后在friendlinks.php中调取数据库数据.并输出适当的html,或者输出xml、json都可以,只是图简单的话,只要输出html就行了.
phpcms 要调用其他数据库时,我们可以直接在后台设置数据源,用get标签调用.
步骤如下:
phpcms 后台模块=>>数据源=>>外部数据源=>>添加外部数据源
设置外部数据源
设置测试OK
前端模板调用:
{loop $data $k $v}
...
{/loop}
{/pc}
希望可以帮到您,望采纳!
一般使用php发送请求,获取返回的数据,进行解析;
php
$url="接口地址";
//发送请求获取返回值,file_get_contents只支持get请求,post使用curl
$json = file_get_contents($url);
//把json数据转化成数组
$data = json_decode($json,true);
//打印看看
print_r($data);
Oracle(甲骨文)是世界上最为流行的关系数据库.它是大公司推崇的工业化的强有力的引擎.我们先看看其相关的函数:
(1)integer
ora_logon(string
user
,
string
password)
开始对一个Oracle数据库服务器的连接.
ora_open(integer
connection)
打开给出的连接的游标.
ora_do(integer
connection,
query)
在给出的连接上执行查询.PHP生成一个指示器,解析查询,并执行之.
ora_parse(integer
cursor,
解析一个查询并准备好执行.
ora_exec(integer
cursor)
执行一个先前由ora_parse函数解析过的查询.
ora_fetch(integer
此函数会使得一个执行过的查询中的行被取到指示器中.这使得您可以调用ora_getcolumn函数.
ora_getcolumn(integer
integer
column)
返回当前的值.列由零开始的数字索引.
ora_logoff(integer
断开对数据库服务器的链接.
以下是向ORACLE数据库插入数据的示例程序:
html
headtitle向ORACLE数据库中插入数据/title/head
body
form
action="?echo
$PHP_SELF;?"
method="post"
table
border="1"
cellspacing="0"
cellpadding="0"
tr
thID/th
thname/th
thDescription/th
/tr
tdinput
type="text"
name="name"
size="10"/td
name="email"
name="Description"
align="center"
td
type="submit"
value="提交" input
type="reset"
value="重写"/td
/table
/form
//先设置两个环境变量ORACLE_HOME,ORACLE_SID
//设置网页显示中文
if($connection=ora_logon("scott","tiger"))
{
//库表test有ID,name,Description三项
$sql
=
'insert
into
test(ID,name,Description)
values
';
.=
'(''
.
$ID
'',''
$name
'',''.
$Description
'')';
if($cursor=ora_do($connect,$sql))
print("insert
finished!");
}
$query
'select
*
from
test';
if($cursor=ora_do($connect,$query))
ora_fetch($cursor);
$content0=ora_getcolumn($cursor,0);
$content1=ora_getcolumn($cursor,1);
print("$content0");
print("$content1");
ora_close($cursor);
ora_logoff($connection);
/body
/html
以上就是土嘎嘎小编为大家整理的php简单调用后端数据相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!