仿先卜php阴盘奇门排盘的算法简述以及php的代码实现开源支持二开

介绍

阴盘奇门,是奇门遁甲的一种,奇门遁甲分阴盘阳盘,阴盘最最近比较流行的一种方式 ,区别于传统排盘,判断较准,排盘更清晰简洁。

有如下几大步骤:

1.排四柱

2.定局数

3.定阴阳

4.排地盘三奇六仪

5.定值符值使

6.布天盘三奇六仪

7.排天盘九星

8.排神盘八神

9.排人盘八门

10.排隐干

11.找马星

12.定空亡

13.移星换半

 global $empire, $dbtbpre, $class_r, $public_r, $post, $addon_name, $addon_set, $xppset, $ga;
        $datestr = $sa['datestr'];
        $xydata = json_decode(file_get_contents(lsk::afPath('data/ypqm/xydata.php')), true);//星运数据
        $time = strtotime($datestr);
        $year = date('Y', $time);
        $month = date('m', $time);
        $day = date('d', $time);
        $hour = date('H', $time);
        $minutes = date('i', $time);
        $seconds = date('s', $time);
        $solar = Solar::fromYmdHms($year, $month, $day, $hour, $minutes, $seconds);
        $lunar = Lunar::fromSolar($solar);
        $bashen = '符,蛇,阴,六,白,玄,地,天';
        $bashenList = explode(',', $bashen);//默认的,按顺序排就行了。
        $jiuxing = '蓬,任,冲,辅,英,芮,柱,心';
        $jiuxingList = explode(',', $jiuxing);//默认的,按顺序排就行了。
        $bamen = '休,生,伤,杜,景,死,惊,开';
        $bamenList = explode(',', $bamen);//默认的,按顺序排就行了。
        $sqly = '戊,己,庚,辛,壬,癸,丁,丙,乙';
        $sqlyList = explode(',', $sqly);//默认的,按顺序排就行了。
        $xslist = array('甲子' => '戊', '甲戌' => '己', '甲申' => '庚', '甲午' => '辛', '甲辰' => '壬', '甲寅' => '癸',);
        $mrlist = array(
            1 => array('short' => '坎', 'title' => '坎一宫', 'zhistr' => '子', 'st_kw' => 0),
            2 => array('short' => '坤', 'title' => '坤二宫', 'zhistr' => '未申', 'st_kw' => 0),
            3 => array('short' => '震', 'title' => '震三宫', 'zhistr' => '卯', 'st_kw' => 0),
            4 => array('short' => '巽', 'title' => '巽四宫', 'zhistr' => '辰巳', 'st_kw' => 0),
            5 => array('short' => '中', 'title' => '中五宫', 'zhistr' => '', 'st_kw' => 0),
            6 => array('short' => '乾', 'title' => '乾六宫', 'zhistr' => '戌亥', 'st_kw' => 0),
            7 => array('short' => '兑', 'title' => '兑七宫', 'zhistr' => '酉', 'st_kw' => 0),
            8 => array('short' => '艮', 'title' => '艮八宫', 'zhistr' => '丑寅', 'st_kw' => 0),
            9 => array('short' => '离', 'title' => '离九宫', 'zhistr' => '午', 'st_kw' => 0),
        );
        $golist = $mrlist;
        foreach ($golist as $kk => $vv) {
            $vv['maxing'] = 0;
            $vv['shenpan'] = array('bashen' => '');
            $vv['tianpan'] = array('jiuxing' => '', 'sqly' => '');
            $vv['dipan'] = array('sqly' => '');
            $vv['renpan'] = array('bamen' => '');
            $vv['kw'] = 0;//是否空亡宫
            $vv['yingan'] = '';
            $golist[$kk] = $vv;
        }
        //1.排四柱
        $yearInfo = array(
            'gan' => $lunar->getYearGan(),
            'zhi' => $lunar->getYearZhi(),
            'xun' => $lunar->getYearXun(),
            'zhiIndex' => $lunar->getYearZhiIndex(),
            'ganIndex' => $lunar->getYearGanIndex()
        );
        $yearInfo['xunshou'] = $yearInfo['xun'] . $xslist[$yearInfo['xun']];
        $yearInfo['ly'] = $xslist[$yearInfo['xun']];
        $monthInfo = array(
            'gan' => $lunar->getMonthGan(),
            'zhi' => $lunar->getMonthZhi(),
            'xun' => $lunar->getMonthXun(),
            'zhiIndex' => $lunar->getMonthZhiIndex(),
            'ganIndex' => $lunar->getMonthGanIndex()
        );
        $monthInfo['xunshou'] = $monthInfo['xun'] . $xslist[$monthInfo['xun']];
        $monthInfo['ly'] = $xslist[$monthInfo['xun']];
        $dayInfo = array(
            'gan' => $lunar->getDayGan(),
            'zhi' => $lunar->getDayZhi(),
            'xun' => $lunar->getDayXun(),
            'zhiIndex' => $lunar->getDayZhiIndex(),
            'ganIndex' => $lunar->getDayGanIndex()
        );
        $dayInfo['xunshou'] = $dayInfo['xun'] . $xslist[$dayInfo['xun']];
        $dayInfo['ly'] = $xslist[$dayInfo['xun']];
        $hourInfo = array(
            'gan' => $lunar->getTimeGan(),
            'zhi' => $lunar->getTimeZhi(),
            'kw' => $lunar->getTimeXunKong(),
            'xun' => $lunar->getTimeXun(),
            'zhiIndex' => $lunar->getTimeZhiIndex(),
            'ganIndex' => $lunar->getTimeGanIndex()
        );
        $hourInfo['xunshou'] = $hourInfo['xun'] . $xslist[$hourInfo['xun']];
        $hourInfo['ly'] = $xslist[$hourInfo['xun']];
        $nlinfo = array(
            'year' => $lunar->getYear(),
            'month' => $lunar->getMonth(),
            'day' => $lunar->getDay(),
            'yearCn' => $lunar->getYearInChinese(),
            'monthCn' => $lunar->getMonthInChinese(),
            'dayCn' => $lunar->getDayInChinese(),
            'datestrCn' => $lunar->toString()
        );
        $nlinfo['datestr'] = $nlinfo['year'] . '-' . str_pad($nlinfo['month'], 2, '0', STR_PAD_LEFT) . '-' . str_pad($nlinfo['day'], 2, '0', STR_PAD_LEFT) . ' ' . $hour . ':' . $minutes . ':' . $seconds;

更多代码私我

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值