创建工作数组值对时出现问题 [英] Problem creating working array value pair
问题描述
我正在制作一些脚本来帮助我自动创建网站
流程。
我想在整个网站上使用模板并致电页面使用
类似
''http://localhost/template.php?page = links''
我实际上有一个工作系统,但我想我会用逗号分隔的密钥=>来改善
。值对。
代码如下。
我使用页面文件名的一部分作为键,值为
< title>< / title>
问题是前9个工作,就是我得到了正确的页面
链接。
当我输入
''http://localhost/template.php?page = plan2''时,我得到默认值''回家''
页。
为了我的生活我没有看到什么是错的。
我用的HTML-Kit和记事本。 (在wysiwyg的过程中或者我们的产品中)
产品)
我认为这是一个文本编码问题,但我是否使用
记事本或HTML-Kit。
<?php
$ allpages = array(
''主页' '=>''家'',
''目的''=>''目的'',
''精神礼品''=>' '精神提升'',
''达到潜力''=>''潜力'',
''减肥''=>''减肥''' ,
''联系我''=>''contactme'',
''Spiritual Gifts2''=>''gifts2'',>
''Spiritual Gifts3''=>''gifts3'',
''链接''=>''链接'',
''计划''=>''计划1'',
''计划''>''计划2'',
''计划''=>''plan3''
);
if(isset($ _ GET [''pa ge('])AND(array_search($ _ GET [''page''],$ allpages)))
{$ thispage = $ _ GET [''page''];
$ title = array_search($ thispage,$ allpages);
}
else
{$ thispage =''home' ';
$ title ="主页" ;;
}
?>
>
allpages = array(
''Home Page''=>''home'',
''目的''=>''目的'',
''精神礼物''=>''spiritgifts'',
''达到潜力''=>''潜在'',
''减肥'=>''减肥'',
''与我联系''' =>''contactme'',
''Spiritual Gifts2''=>''gifts2'',
''Spiritual Gifts3''=>' 'gifts3'',
''链接''=>''链接'',
''计划''=>''plan1' ,
''计划''>''计划2'',
''计划''>''计划3''
);
if(isset(
_GET [''page''])AND(array_search(
)
_GET [ '' 页 ''],
I am working on some scripts to help me automate the website creation
process.
I want to use a template for the whole website and call pages using
something like
''http://localhost/template.php?page=links''
I actually have a working system, but I thought I would improve by
using comma-separated key => value pairs.
The code is below.
I am using the part of the page filename as the key and the value as
the <title></title>
Problem is that the first 9 work, that is I get the correct page
linked.
When I enter
''http://localhost/template.php?page=plan2'', I get the default ''home''
page.
For the life of me I don''t see what is wrong.
I use HTML-Kit and notepad. (in the process or weening of wysiwyg
products)
I considered it was a text encoding problem but the same whether I use
notepad or HTML-Kit.
<?php
$allpages=array(
''Home Page''=>''home'',
''Purpose''=>''purpose'',
''Spiritual Gifts''=>''spiritgifts'',
''Reaching Potential''=>''potential'',
''Weight Loss''=>''weightloss'',
''Contact Me''=>''contactme'',
''Spiritual Gifts2''=>''gifts2'',
''Spiritual Gifts3''=>''gifts3'',
''Links''=>''links'',
''The Plan''=>''plan1'',
''The Plan''=>''plan2'',
''The Plan''=>''plan3''
);
if (isset($_GET[''page'']) AND (array_search($_GET[''page''], $allpages)))
{ $thispage=$_GET[''page''];
$title=array_search($thispage, $allpages);
}
else
{ $thispage=''home'';
$title="Home Page";
}
?>
allpages=array(
''Home Page''=>''home'',
''Purpose''=>''purpose'',
''Spiritual Gifts''=>''spiritgifts'',
''Reaching Potential''=>''potential'',
''Weight Loss''=>''weightloss'',
''Contact Me''=>''contactme'',
''Spiritual Gifts2''=>''gifts2'',
''Spiritual Gifts3''=>''gifts3'',
''Links''=>''links'',
''The Plan''=>''plan1'',
''The Plan''=>''plan2'',
''The Plan''=>''plan3''
);
if (isset(
_GET[''page'']) AND (array_search(
_GET[''page''],
这篇关于创建工作数组值对时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!