Code Monkey home page Code Monkey logo

etaoism's Introduction

Efairy

介绍

基于PHP的算命核心 简单演示:http://www.panyunxi.com/

软件架构

环境要求: php5.3以上 ,建议使用PHP7 composer

安装教程

composer require gclinux/etaoism

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

文档

本程序主要是对算命核心的一个演示,核心提供下列功能.

1.精确到秒的节气识别

2.新历的八字排盘运算

3.十神运算

4.十二长生运算

5.五行生旺运算

6.常用星煞运算

7.提供合,生,克,三合,半合,对冲,刑穿的检测方法

为帮助您看懂代码,您先阅读下面资料,并熟悉五行及易经的基本内容.推荐先阅读<四柱预测>入门的读物

数字化的传统表达

大部分情况下,程序在表达上使用数字替代天干地支和五行.

五行

五行的顺序为 木火土金水,程序上用0到4表示,分别为

0-木,1-火,2-土,3-金,4-火

天干与地支

天干 : '甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸',分别按顺序用0到9表示

地支:'子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥' 分别按顺序用0到11表示,生肖与之一致

12长生:"生", "沐", "冠", "临", "旺", "衰", "病", "死", "墓", "绝","胎", "养" 分别用0到11表示

十神

与上面不同 十神使用二维数组成对表示

数组如下:

[['比', '劫'], ['食', '伤'], ['财', '才'],[ '杀', '官'], ['枭', '印']]

在记录表达上一般情况只记录索引,

例如比,记录索引为 [0,0],才记录为[2,0],官表示为[3,1];

大部分情况下,调用 gclinux\Etaoism\Stars::getInfo 方法,即可.

方法: getInfo($gd, $yy, $mm, $dd, $hh, $mt=0, $ss=0){

参数说明:

* @param int $gd 0男1女

* @param int $yy

* @param int $mm

* @param int $dd

* @param int $hh 时间(0-23)

* @param int $mt 分钟数(0-59),在跨节的时辰上会需要,有的排盘忽略了跨节

* @param int $ss 秒数(0-59)

* @return array

下面内容可能会在网页上出现排版问题,建议直接看read.md文件

返回数组说明: { sex: 性别,0为男,1为女, tg: [//天干 年天干索引, 月天干索引, 日天干索引, 时天干索引 ], dz: [//地支 年地支索引, 月地支索引, 日地支索引, 时地支索引 ], bazi: [//八字的文字表述,对应上面 [ "戊", "辰", ], [ ], ... ], sc: {//时辰分段,盲派可能用到 把时辰分为3段, index: [ 1,//时辰索引 2,//分段索引,0-头,1-中,2-尾 ], char: "丑时尾", }, dz_cg: [ //地支藏干,分别是年,月,日,时的藏干 { index: [ //索引 4, 1, 9, ], char: [ //索引对应的字符 "戊", "乙", "癸", ], }, { index: [ x //屏蔽了 x x ], char: [ "x", "x", "x", ], }, { index: [ x //屏蔽了 x x ], char: [ "x", "x", "x", ], }, { index: [ x //屏蔽了 x x ], char: [ "x", "x", "x", ], }, ], na_yin: [//4柱的纳音,对应年,月,日,时 [ "大林木", 0,//纳音属性,0为木,1为火,如此类推 ], ...//其余3个成员,一共4个成员 ], xw: {//空亡的地支,总会有两个地支空的 index: [ 4, 5, ], char: "辰巳", }, gong: { 宫 index: [ 1, 3, ], char: "乙卯", }, tg_cg_god: [ 天干的十神,索引表示参考文档前面内容 { index: [ 2, 1, ], char: "才", }, ....//其他3个 ], dz_main_god: [//地支的十神 [],[],[],[] ], day_cs: [//日游走4柱的长生,能让你了解日的能力影响情况 { index: 2, char: "冠", }, { index: 5, char: "衰", }, { index: 11, char: "养", }, { index: 5, char: "衰", }, ], year_cs: [ { ... }, { ... }, ... ], big_tg: [ //大运的天干 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, ], big_dz: [ //大运的地支 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, ], start_desc: "X年X月X天起运",//起运时间描述 start_time: [//起运具体时间点 1989,//年 xx,//月 xx,//日 2,//时 0,//分 24,//苗 ], years: [ ], big: [//大运的传统字符表示 "丙寅", "丁卯", "戊辰", ... ], big_cs: [//大运的长生情况 { index: 4, char: "旺", }, ...//忽略 ], big_god: [ //大运的十神 { index: [ 1, 1, ], char: "伤", }, ...省略 ], big_start_time: [ [//大运时间卡点 年, 月, 日, 时, 分, 秒 ], [ 1999, 2, 11, 2, 3, 24, ], ... ], xz: "水瓶座",//星座 sx: "龙",//生肖 years_info: [ //大运的卡点年资料 { year: 1989,//年 index: [ 5,//年的天干 5,//年的地支 ], char: "己巳",//传统表达 cg: [ //地支藏干 2, 4, 6, ], cs: {//那年的长生情况 index: 1, char: "沐", }, tg_god: {//年份对应的十神 index: [ 2, 0, ], char: "财", }, dz_god: [//地支的十神 { index: [ 2, 0, ], char: "财", }, { index: [ 4, 0, ], char: "枭", }, ... ], []...//多个类推 ], star: [//星煞 总体4个对象,对应4柱 { 0: ["kongWang","空亡",], 2: ["taiJi","太极",],//星煞索引:[唯一名,传统表达名] }, {月} ,{日} ,{时} ], }, ], }

etaoism's People

Contributors

etaoism avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.