周易八字测算引流seo程序PHP源码实现方法包含黄历/测算/排盘/抽签/星座/生肖/解梦板块

界面设计

分栏目展示不同功能

1、框架自带栏目分类,各个栏目要想实现不同的功能,可以根据栏目id调用不同的本程序内部接口实现。

2、内部接口可以在其他控制器编写,比如

	public function baziwuxing(){
		$year = $_GET['year'];
		$month = $_GET['month'];
		$day = $_GET['day'];
		$hour = $_GET['hour'];
		$solar = Solar::fromYmdHms($year,$month,$day,$hour,0,0);
		$lunar = $solar->getLunar();
		
        $re['sx'] = $lunar->getYearShengXiao();
		$re['niannayin'] = $lunar->getYearNaYin();
		$re['rinayin'] = $lunar->getDayNaYin();
		$re['shinayin'] = $lunar->getTimeNaYin();
		$re['yuenayin'] = $lunar->getMonthNaYin();
		$re['nianganzhi'] = $lunar->getYearInGanZhi();
		$re['yueganzhi'] = $lunar->getMonthInGanZhi();
		$re['riganzhi'] = $lunar->getDayInGanZhi();	
        $re['shiganzhi'] = $lunar->getTimeInGanZhi();	
		$re['wuxing'] = $lunar->getBaZiWuXing();
		$re['shishen'] = $lunar->getBaZiShiShenGan();

		$re['nnian'] = $lunar->getYearInChinese();//农历年
		$re['nyue'] = $lunar->getMonthInChinese();//农历月
		$re['nri'] = $lunar->getDayInChinese();//农历日
		$re['nianling'] = date('Y',time()) - $year;//年龄
			
		$re['niangan'] = $lunar->getYearGan();
		$re['nianzhi'] = $lunar->getYearZhi();
		$re['yuegan'] = $lunar->getMonthGan();
		$re['yuezhi'] = $lunar->getMonthZhi();
		$re['rigan'] = $lunar->getDayGan();
		$re['rizhi'] = $lunar->getDayZhi();
        $re['shigan'] = $lunar->getTimeGan();
		$re['shizhi'] = $lunar->getTimeZhi();
		$wxarr = array(M('mod_wuhangbazi')->tgdzwh($re['niangan']),M('mod_wuhangbazi')->tgdzwh($re['nianzhi']),M('mod_wuhangbazi')->tgdzwh($re['yuegan']),M('mod_wuhangbazi')->tgdzwh($re['yuezhi']),M('mod_wuhangbazi')->tgdzwh($re['rigan']),M('mod_wuhangbazi')->tgdzwh($re['rizhi']),M('mod_wuhangbazi')->tgdzwh($re['shigan']),M('mod_wuhangbazi')->tgdzwh($re['shizhi']));
		$re['jinshu'] = M('mod_suanming')->howstring($wxarr,'金');
		$re['mushu'] = M('mod_suanming')->howstring($wxarr,'木');
		$re['shuishu'] = M('mod_suanming')->howstring($wxarr,'水');
		$re['huoshu'] = M('mod_suanming')->howstring($wxarr,'火');
		$re['tushu'] = M('mod_suanming')->howstring($wxarr,'土');
		$re['jinbi'] = round(($re['jinshu'] / 8) * 100, 2);
		$re['mubi'] = round(($re['mushu'] / 8) * 100, 2);
		$re['shuibi'] = round(($re['shuishu'] / 8) * 100, 2);
		$re['huobi'] = round(($re['huoshu'] / 8) * 100, 2);
		$re['tubi'] = round(($re['tushu'] / 8) * 100, 2);
		
		$wuxingdafen = GladUseGod::getGladUseGodDetails($re['nianganzhi'].$re['yueganzhi'].$re['riganzhi'].$re['shiganzhi']);//五行打分
		$wuxingdafen['chazhi'] = $wuxingdafen['strength_same'] - $wuxingdafen['strength_diff'];
		$wuxingdafen['abschazhi'] = abs($wuxingdafen['chazhi']);
		if($wuxingdafen['chazhi']<0 && $wuxingdafen['abschazhi']>0.8){
			$wuxingdafen['ruo'] = '八字较弱';
		}elseif($wuxingdafen['chazhi']>0 && $wuxingdafen['abschazhi']>0.8){
			$wuxingdafen['ruo'] = '八字过硬';
		}else{
			$wuxingdafen['ruo'] = '八字较平衡';
		}



		if($wuxingdafen['chazhi']<0){
			$same = array($wuxingdafen['same'][0]=>$wuxingdafen['strength_all'][$wuxingdafen['same'][0]],$wuxingdafen['same'][1]=>$wuxingdafen['strength_all'][$wuxingdafen['same'][1]]);
			$minKey = array_keys($same, min($same));
			//print_r($minKey[0]);
		}else{
			$diff = array($wuxingdafen['diff'][0]=>$wuxingdafen['strength_all'][$wuxingdafen['diff'][0]],$wuxingdafen['diff'][1]=>$wuxingdafen['strength_all'][$wuxingdafen['diff'][1]],$wuxingdafen['diff'][2]=>$wuxingdafen['strength_all'][$wuxingdafen['diff'][2]]);
			$minKey = array_keys($diff, min($diff));
		}
		$wuxingdafen['xishen'] = $minKey[0];


		//四季用神参考
		$jijie = M('mod_wuhangbazi')->siji($month);
		$sijidb = D('sm_sjrs');
		$sijiarr = $sijidb->where(array('wh'=>M('mod_wuhangbazi')->tgdzwh($re['rigan']),'sj'=>$jijie))->find();
        //穷通宝鉴
		$qtbjdb = D('sm_qtbj');
		$qtbjarr = $qtbjdb->where(array('tg'=>$re['rigan'],'dz'=>$re['yuezhi']))->find();

		return_json(array('errcode'=>0,'wxarr'=>$wxarr,'qtbj'=>$qtbjarr,'siji'=>$sijiarr,'info'=>$wuxingdafen,'ra'=>$re));



		}

3、栏目调用内部接口

		if($catid == 2){
			if($_POST){
				if(!$_POST['xing']){
					$xingming = $_POST['xingming'];
					if(countChineseChars($xingming)>3){
						$xing = substr($xingming,0,6);
						$ming = substr($xingming,6,6);
					}else{
						$xing = substr($xingming,0,3);
						$ming = substr($xingming,3,6);
					}
				}else{
				    $xing = $_POST['xing'];
				    $ming = $_POST['name'];
				}
				$sex = $_POST['sex'];//0男1女
				if($sex == 0){
					$sexhz = '男';
				}else{
					$sexhz = '女';
				}
				$year = $_POST['y'];
				$month = $_POST['m'];
				$day = $_POST['d'];
				if(!$_POST['h']){
					$hour = 0;
				}else{
					$hour = $_POST['h'];
				}
				$minute = $_POST['i'];
				$resultjson = file_get_contents('/sm/sm/baziwuxing/xing/'.$xing.'/ming/'.$ming.'/sex/'.$sex.'/year/'.$year.'/month/'.$month.'/day/'.$day.'/hour/'.$hour);
				$resultarr = json_decode($resultjson, true);
				//print_r($resultarr);
			}
		}

前端调用

{if $_POST}
			<link rel="stylesheet" href="/statics/pc/tool/sscy/style.min.css">
						<div class="sscy">
							<h1 class="title title-center">八字测算结果</h1>
							<div class="sscy-result">
								<table class="sscy-result__base">
									<tr>
										<td class="th">姓名</td>
										<td>{$xing}{$ming}</td>
										<td class="th">性别</td>
										<td>{$sexhz}</td>
										<td class="th">出生时间</td>
										<td width="250px">{$year}年{$month}月{$day}日{$hour}时</td>
									</tr>
									<tr>
										<td class="th">今年</td>
										<td>{$resultarr[cookies][nianling][nl]}岁</td>
										<td class="th">属相</td>
										<td>{$resultarr[cookies][sx]}</td>
										<td colspan="2"></td>
									</tr>
								</table>
								<div class="sscy-result__content">
									<h2>{$resultarr[ra][zao]}:</h2>
									<p>{$resultarr[ra][bazi]}</p>
									<h2>大运:</h2>
									<p>{$resultarr[ra][dayun]}</p>
									<h2>性格分析:</h2>
									<p>{$resultarr[ra][xgfx]}
									</p>
									<h2>命造简批:</h2>
									<p>
										{$resultarr[ra][mzjp]}</p>
								</div>
							</div>
							<div class="sscy-btn">
						<a href="{get_category($catid,'pclink')}">重新测算</a>
						<a href="/go.php?id=1" class="scbz-btn__ffsm J_form_app_submit">精准算命</a>
							</div>
							<p class="mt30">本测算系统来源于中国民俗学的一些测算方法,并非科学研究成果,仅供休闲娱乐,请勿迷信,按此操作一切后果自负!</p>
						</div>{else}
				<div class="scbz">
					<h1 class="title title-center">八字简批</h1>
					<form class="scbz-form J_form_tool" method="POST" action="{get_category('9','pclink')}">
						<label>&emsp;姓</label>
						<input type="text" name="xing" placeholder="请输入汉字" data-text="您的姓" data-rule='require|chs:1,2' />
						<label>名</label>
						<input type="text" name="name" placeholder="请输入汉字" data-text="您的名" data-rule='require|chs:1,2' />
						<label>性别</label>
						<div class="radio J_radio">
							<span class="radio-item J_radio_item active" data-value="0">男</span>
							<span class="radio-item J_radio_item" data-value="1">女</span>
							<input type="hidden" name="sex" value="0" />
						</div>
						<div class="J_date_c_picker">
							<label>生日</label>
							<div class="select J_select">
								<span></span>
								<select name="y">
    <?php for($i=1945;$i<2100;$i++){ ?>
    <?php if($i==date('Y',time())){$se='selected';}else{$se='';} ?>
    <option value="<?=$i?>" <?=$se?>><?=$i?></option>
    <?php }?>
								</select>
							</div>
							<label>年</label>
							<div class="select J_select">
								<span></span>
								<select name="m">
    <?php for($i=1;$i<13;$i++){ ?>
    <?php if($i==date('m',time())){$se='selected';}else{$se='';} ?>
    <option value="<?=$i?>" <?=$se?>><?=$i?></option>
    <?php }?>
								</select>
							</div>
							<label>月</label>
							<div class="select J_select">
								<span></span>
								<select name="d">
    <?php for($i=1;$i<32;$i++){ ?>
    <?php if($i==date('d',time())){$se='selected';}else{$se='';} ?>
    <option value="<?=$i?>" <?=$se?>><?=$i?></option>
    <?php }?>
								</select>
							</div>
							<label>日</label>
							<br />
							<label>&emsp;&emsp;</label>
							<div class="select J_select">
								<span></span>
								<select name="h">
{php $shichen = date('H',time());}
<option {if $shichen==0}selected="selected"{else}{/if} value="0">子 00:00-00:59</option>
<option {if $shichen==1}selected="selected"{else}{/if} value="1">丑 01:00-01:59</option>
<option {if $shichen==2}selected="selected"{else}{/if} value="2">丑 02:00-02:59</option>
<option {if $shichen==3}selected="selected"{else}{/if} value="3">寅 03:00-03:59</option>
<option {if $shichen==4}selected="selected"{else}{/if} value="4">寅 04:00-04:59</option>
<option {if $shichen==5}selected="selected"{else}{/if} value="5">卯 05:00-05:59</option>
<option {if $shichen==6}selected="selected"{else}{/if} value="6">卯 06:00-06:59</option>
<option {if $shichen==7}selected="selected"{else}{/if} value="7">辰 07:00-07:59</option>
<option {if $shichen==8}selected="selected"{else}{/if} value="8">辰 08:00-08:59</option>
<option {if $shichen==9}selected="selected"{else}{/if} value="9">巳 09:00-09:59</option>
<option {if $shichen==10}selected="selected"{else}{/if} value="10">巳 10:00-10:59</option>
<option {if $shichen==11}selected="selected"{else}{/if} value="11">午 11:00-11:59</option>
<option {if $shichen==12}selected="selected"{else}{/if} value="12">午 12:00-12:59</option>
<option {if $shichen==13}selected="selected"{else}{/if} value="13">未 13:00-13:59</option>
<option {if $shichen==14}selected="selected"{else}{/if} value="14">未 14:00-14:59</option>
<option {if $shichen==15}selected="selected"{else}{/if} value="15">申 15:00-15:59</option>
<option {if $shichen==16}selected="selected"{else}{/if} value="16">申 16:00-16:59</option>
<option {if $shichen==17}selected="selected"{else}{/if} value="17">酉 17:00-17:59</option>
<option {if $shichen==18}selected="selected"{else}{/if} value="18">酉 18:00-18:59</option>
<option {if $shichen==19}selected="selected"{else}{/if} value="19">戌 19:00-19:59</option>
<option {if $shichen==20}selected="selected"{else}{/if} value="20">戌 20:00-20:59</option>
<option {if $shichen==21}selected="selected"{else}{/if} value="21">亥 21:00-21:59</option>
<option {if $shichen==22}selected="selected"{else}{/if} value="22">亥 22:00-22:59</option>
<option {if $shichen==23}selected="selected"{else}{/if} value="23">子 23:00-23:59</option>
								</select>
							</div>
							<label>时</label>
							<div class="select J_select">
								<span></span>
								<select name="i">
									<option value="0">未知</option>
    <?php for($i=0;$i<60;$i++){ ?>
    <?php if($i==date('d',time())){$se='selected';}else{$se='';} ?>
    <option value="<?=$i?>" <?=$se?>><?=$i?></option>
    <?php }?>
								</select>
							</div>
							<label>分</label>
						</div>
						<input type="hidden" name=ct value="suanming">
						<input type="hidden" name=ac value="sm_form">
						<input type="hidden" name=cY value="">
						<input type="hidden" name=cM value="">
						<input type="hidden" name=cD value="">
						<input type="hidden" name=cH value="">
						<input type="hidden" name=term1 value="">
						<input type="hidden" name=term2 value="">
						<input type="hidden" name=start_term value="">
						<input type="hidden" name=end_term value="">
						<input type="hidden" name=start_term1 value="">
						<input type="hidden" name=end_term1 value="">
						<input type="hidden" name=lDate value="">
						<input type="hidden" name="base" value="365">
						<div class="scbz-btn">
							<a href="javascript:;" class="scbz-btn__free J_form_tool_submit">立即测算</a>
							<a class="scbz-btn__ffsm" rel="nofollow" href="/go.php?id=1" target="_blank">超准测算</a>
						</div>
					</form>
					<h2>八字简批</h2>
					<p>「八字测算」八字完全是由人的出生时间所确定,是指人出生年月日时的干支表示,又有年柱、月柱、日柱、时柱之分,而且每柱有2字,一共有八个字,所以称为"八字",又叫「四柱八字」。</p>
				</div>{/if}

总结

用php框架写程序总体是比较简单的,而且框架自带的某些功能可以直接使用,比如文章系统,附带的插件等。

本文由奥顺互联原创,转载请注明出处!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值