web人力资源信息系统开发日志③

作者: 人可工作室 分类: 开发体验笔记 发布时间: 2017-06-20 14:32

第三阶段(2017年5月21—6月20日):主要开发内容重心转向用户业务管理层,业务逻辑是用PHP程序对数据库表进行调用,满足业务管理需求。数据库除了安装PDO驱动外还需要安装ODBC相应的驱动,便于以后使用ODBC数据源接口导入导出公司原有数据,方法是在MySQL官网下载mysql-connector-odbc稳定5.3版本32位安装,然后在启动->windows文件管理->ODBC数据资源管理程序中添加相应的mysql驱动程序。主体开发可参考ppphp轻量级开发框架、H-ui前端框架、敏捷框架、Medoo数据库框架来自定义搭建项目骨架,理清项目开发主线,正式开始一步步开发完成整个项目主体内容,为后期上线测试奠定坚实基础。

 

开发内容:

①cookie里存的是加过aes加密后的用户编号和salt盐,验证cookie时就是aes解密后拿出用户编号查询user表拿到该用户的salt字段内容跟cookie里的salt对比,一致则cookie有效,通过验证,提取存储用户信息为后台传递参数,提供系统内页使用。

②系统初始化配置与内页调用机制的代码编写。

③加载common函数库,用对应函数分裂前端框UI架静态页面的页眉、页脚、主菜单。把实用工具或解决方法集成到函数库中或function.php文件中,在项目各功能模块需要时直接引用,让工具来去自由,快速破解各功能模块中相关联的疑难杂症,确保公共函数“招之即来,挥之即去”。

④用数据表存储或自定义常量生成系统菜单。

⑤选择合适前端开发框架,编写控制层核心代码,以确保组织机构维护、员工自然状况维护、工资人事数据维护、报表查询及数据导出导入等日常业务功能的实现。

⑥实现便捷数据处理及图形报表查询功能并另存为网页或电子表格式文件。

⑦ODBC数据源接口生成报表,充分利用公司原有VFP数据库资源。

⑧结合PHP安装运行环境以官方文档为指导规范性选择使用合适版本的Medoo数据库框架,快速解决medel层数据库多样化操作。

开发技巧:

①命名规范。因为远程虚拟主机Linux运行环境对设置为路径和文件名是严格区分大小写的,为了安全稳定运行,项目文件夹、数据库名、数据表名、表前缀、字段名统一用小写字母或加下划线命名,需要特殊命名时就使用“小驼峰”命名法或类首写字母大写法,程序中注意严格区分大小写。

②安全操作。考虑防止SQL注入等安全性操作问题,必须编写完整的用户注册登录加密验证系统与单一入口文件配合使用。

③深刻理解MVC和结构化编程。在MVC模式中Controller控制器是Model和View两者交互的中介,负责通过路由解析URL提交两者处理,Model模型层负责读写数据,View视图层负责视图处理输出。说MVC是一种技术,不如说是一种艺术,MVC理念来源于工作和生活,又服务于工作和生活。MVC不是哪门开发语言的专利,也不局限于哪个项目之上,MVC思想理念广泛用于所有开发语言的各种项目开发中。用PHP开发MIS就是紧紧围绕MVC三个层级关系用结构化编程思路方便快捷实现业务逻辑处理。结构化程序更容易编写和测试,因为复杂的编程问题被划分为多个更小的、更简单的任务。每个任务由一段代码或一个函数完成,而函数中的代码和变量独立于程序的其它部分。通过每次处理一个简单的任务,编程目标定位将更快更准,还容易维护。

④多个浏览器交替调试。为了提高浏览页面速度,现在的浏览器缓存是越来越厉害了,编程过程中特别要当心掉进缓存这个坑里,被缓存蒙蔽。必须采用两个以上浏览器交替调试程序,并在明显知道代码真假的位置设置断点有意变更变量或文件名反复测试程序运行真假,绕过缓存假象这个坑。

⑤为了防止批量盗链站点内容默认用自定义常量ROOT在任意子目录下使用绝对路径引入或包含文件。在远程虚拟主机Lninux中,”.”表示当前目录,”..”来表示上一级目录。”-“表示上次所在目录,”~”表示当前用户的home目录,也可用”pwd”查看当前所在的绝对路径。

从方便编码和页面跳转稳定运行的角度考虑,常用相对路径去include/require文件或跳转,但上线安全测试时加以修改为绝对路径,减轻服务器搜索文件压力,既提升产品性能和应用效率,又防止被大面积盗链。

体会感悟:

①合理使用插件给力正能量。后台这块的难度主要在于二次开发中可能会涉及到数据的图表展示,需要用到JS插件来完成,数据的表格、表单展示,用插件自带的数据表格,实现了对表单的排序和搜索,借外脑给力系统集成与开发,大大简化了项目开发的工作量。

②自定义搭建适合开发框架。

框架(framework)是一个基本概念上的结构,用于去解决或处理系统性复杂的问题。说白了用框架就是使用别人造好的轮子。“来得轻松,去得易;出来混,早晚要还的”。用别人的轮子,总要为莫名其妙的东东付出太多迷茫调试的代价。再说大型框架还是重复用一堆代码构建于 PHP 之上,所以追求极致性能的话,不建议过多重复用代码搭积木。其实最优雅的框架就是PHP本身,自己原码搭建框架与其说是在用框架,还不如说是梳理出项目开发思路和搭好项目架构,更重要的是,通过自己搭建适合项目需要的MVC架构,把自己的想法融入到框架中,不一定是最好的,但可以按照自己的方式开发各种实用功能,让自己深入理解MVC开发模式,也让自己能够在业务项目开发过程中快速提升技能,培养独立思考的能力,掌握MVC框架实质和PHP面向对象实例化应用,从中熟悉PHP的各种代码优化方法,熟悉大部分PHP安全方面问题的解决办法和熟悉基本的PHP运行机制原理。因为PHP本身就支持模板功能,所以也没必要非使用第三方模板引擎不可,又因为PDO+SQL就已经能良好的抽象数据库操作,用PHP数组就能方便地存储和操作查询结果,用自定义函数封装项目功能模块,函数式结构化编程使用灵活又容易维护。既然面对五花八门的各种框架,实在难以决择,还不如原生结构化开发,既降低学习成本又能体验高性能PHP服务,入门还是先摆一摆大型专业框架以后再说。随着手持设备的迅猛发展,带动了HTML5行业标准的快速发展,为了满足Web前端高度灵活开发需要,以适应不同的浏览器、平板、智能手机各种各样的手持设备,非要用响应式策略开发框架不可,那就用轻量级前端框架如H-ui或敏捷框架之类。

总之,用PHP原生面向对象赋予MVC思想绕开诸多框架的喧嚣,不被框架绑架,灵活多样化的PHP自主原生开发是依赖性框架开发所望尘莫及的,以最简单的方式去诠释高效才是王道。

③坚持大道至简的核心开发理念。PHP素来以简单著称,开发过中切莫刻意把PHP代码编写弄得莫测高深,只要“方法可取、运行稳定、满足需求”,编程中的每个环节都要尽量去繁就简,易于上手,易于理解,都往简单处想,越简单越快乐,越简单越有力量。

④站在巨人的肩膀上更容易摘到苹果。Composer是一个出色的PHP依赖管理器,把项目的依赖列在composer.json文件中,然后通过一些简单的命令,Composer就会自动的帮你下载这些依赖,并配置好自动加载路径。根据项目扩展需要,用composer install/update 声明依赖、安装、更新自动加载第三方类库或插件,大大提升了开发Web应用的效率与性能,还能帮我们发布开发好的产品,永久提供更新管理App项目功能。

⑤快速入门突破难关。PHP+MySQL开发管理信息系统已经成为大家追捧的潮流,管理信息系统注重业务实用性,难在功能实现和应用推广上,原因多半是程序开发与业务需求脱节,懂技术的程序员不懂业务,有业务需求的客户又不懂技术,无形中增加了沟通难度,程序维护也很困难。无穷无尽的业务需求,期待实用易用的管理信息系统(MIS),Web Apps势不可挡,顺应时代召唤,不适合时代的操作习惯和应用方式将会逐渐被MIS所取代,只要坚定方向从从容容走下去,相信有朝一日总会突破各种难题。

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

24 条评论
  • hermes handbags

    2022年11月18日 上午8:37

    I would like to show my thanks to the writer just for rescuing me from this particular setting. Just after surfing throughout the online world and obtaining principles which are not pleasant, I believed my life was over. Being alive without the strategies to the issues you have resolved by way of this write-up is a critical case, and those which could have in a wrong way affected my entire career if I hadn’t discovered your site. Your own personal mastery and kindness in dealing with almost everything was crucial. I’m not sure what I would have done if I hadn’t come upon such a subject like this. I am able to now relish my future. Thanks a lot very much for your specialized and amazing guide. I will not think twice to suggest your site to anybody who requires tips on this situation.

    我想对作者表示感谢,感谢他把我从这个特殊的环境中拯救出来。在网上冲浪并获得了一些不愉快的原则后,我认为我的生命结束了。没有你通过这篇文章解决的问题的策略是一个严重的情况,如果我没有发现你的网站,这些可能会以错误的方式影响我的整个职业生涯。你个人在处理几乎所有事情时的掌控力和仁慈是至关重要的。我不知道如果我没有遇到这样一个主题,我会做些什么。我现在能够享受我的未来。非常感谢你的专业和惊人的指导。在这种情况下,我会毫不犹豫地向任何需要提示的人推荐你的网站。

  • Marcelino

    2019年7月24日 下午5:50

    Greate post. Keep posting such kind of information on your page.

    Im really impressed by your blog.
    Hey there, You’ve performed an excellent job.
    I will definitely digg it and in my opinion recommend to my friends.
    I am confident they will be benefited from this site.

  • Bebe

    2019年7月24日 上午9:16

    It is appropriate time to make some plans for the long run and it’s time
    to be happy. I’ve learn this put up and if I may just
    I wish to recommend you some fascinating issues or suggestions.
    Perhaps you could write subsequent articles relating
    to this article. I wish to learn even more issues approximately it!

  • Scot

    2019年7月24日 上午4:54

    This piece of writing will assist the internet viewers for setting up new blog or
    even a weblog from start to end.

  • Kieran

    2019年7月24日 上午12:05

    Howdy! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading your blog posts.

    Can you recommend any other blogs/websites/forums that deal with the same topics?
    Thanks a lot!

  • Vance

    2019年7月23日 上午9:00

    Hi there, I read your blogs daily. Your humoristic style is witty, keep doing what you’re doing!

  • Myrtle

    2019年7月22日 下午8:50

    I every time used to study paragraph in news papers but now as I am a user of internet so
    from now I am using net for articles or reviews, thanks to web.

  • Boris

    2019年7月22日 下午2:23

    Very good blog post. I definitely appreciate this site. Continue
    the good work!

  • Wilford

    2019年7月22日 上午5:30

    An outstanding share! I’ve just forwarded this onto a co-worker who has been conducting a little
    research on this. And he actually bought me dinner simply because I
    discovered it for him… lol. So allow me to reword this….

    Thanks for the meal!! But yeah, thanx for spending some time to
    talk about this topic here on your web page.

  • Odessa

    2019年7月21日 下午2:07

    This is really interesting, You are a very skilled blogger.

    I have joined your feed and look forward to seeking more of your
    excellent post. Also, I have shared your site in my social networks!

  • Brock

    2019年7月21日 上午6:49

    Hi, I think your blog might be having browser compatibility issues.
    When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, fantastic blog!

  • Rueben

    2019年7月20日 下午1:04

    Hi there, You’ve done an incredible job. I will certainly digg it and personally suggest to my friends.
    I’m confident they will be benefited from this site.

  • Mauricio

    2019年7月19日 上午5:50

    It’s an remarkable post in support of all the web
    users; they will get advantage from it I am sure.

  • Deon

    2019年7月18日 下午1:12

    It’s awesome to go to see this web page and reading the views of all mates about this article, while I am also zealous of getting experience.

  • Cathy

    2019年7月18日 上午11:18

    Wow, marvelous blog layout! How lengthy have you ever
    been blogging for? you make blogging glance easy. The full look
    of your website is wonderful, as neatly as the content material!

  • Barrett

    2019年7月17日 上午10:01

    Hey there! I know this is kinda off topic but I was wondering if you knew
    where I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours
    and I’m having difficulty finding one? Thanks
    a lot!

  • Coy

    2019年7月12日 下午2:26

    I’m not that much of a internet reader to be honest but your blogs really nice, keep it up!
    I’ll go ahead and bookmark your website to come back down the road.
    All the best

  • Ulrike

    2019年7月12日 上午12:55

    We stumbled over here coming from a different web address and thought I may as well check things out.
    I like what I see so now i am following you. Look forward to going over your web page repeatedly.

  • Sherrie

    2019年7月11日 下午4:10

    I am sure this piece of writing has touched all the internet users, its really really fastidious piece of writing on building up new blog.

  • Johanna

    2019年7月11日 下午3:31

    Thanks for any other fantastic article. Where else may
    anybody get that kind of information in such a perfect means of writing?
    I have a presentation next week, and I’m at
    the look for such information.

  • Ferdinand

    2019年7月11日 下午3:10

    obviously like your web site but you need to check the spelling on quite a few of your posts.

    Several of them are rife with spelling problems and
    I find it very bothersome to inform the truth nevertheless I’ll definitely come back again.

  • Beau

    2019年7月10日 上午6:14

    Hello there! Would you mind if I share your blog with my myspace group?
    There’s a lot of people that I think would really enjoy your content.
    Please let me know. Cheers

  • ig

    2019年6月29日 下午10:41

    My spouse and I stumbled over here coming from a different website and thought I
    might check things out. I like what I see so i am just following you.
    Look forward to finding out about your web page again.

  • Peggy

    2019年6月28日 下午2:44

    I really love your blog.. Very nice colors & theme.
    Did you create this amazing site yourself? Please reply back as I’m trying to create my own personal website and would like to learn where you
    got this from or what the theme is called. Cheers!

回复 Peggy 取消回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注