前言
这篇文章主要分享下自己在开发Web App遇到的问题和过程,以及一些很已经(如何)填平的坑。如果您想要“如何开发Web App”或《30分钟学会开发Web App》,请移步官方的开发手册(文档)。(下有链接)。
背景
感觉现在大家都在争论(讨论)两件事情,Web App和Native App。前不久参加的HTML5守望者活动,各方大佬都在针对这二者之间的优劣,差异,兼容,普及等进行探讨。当然,有争议的才说明有价值嘛。
Chrome Web App
前不久Chrome又一次因超过了什么什么登上了各大新闻媒体的首页,是的这已经不是第一次了。Chrome自身有强大的插件市场,和最近(也不算最近了)推出的Chrome Web App。之前也一直有进行过Chrome拓展的开发,被Chrome自身的API搞的晕头转向,不过在转晕的同时也深深感受到了Web App的强大潜力。
制作Web App
刚刚试图把一个简单的“网页项目”移植成Chrome Web App,说是移植,其实基本上就是重建,哦不,是新建……。现在的网页项目是一个使用PHP、MySQL做后端,很常见的一个PHP网站,使用了Slim做为PHP框架。
那么如何新建成Chrome Web App呢。显而易见,使用PHP不大可能了。之前使用过Google自家的AngularJS做开发,所以还算熟悉,而且官方开发手册也把AngularJS做首选的推荐开发框架。而且得益于Slim框架(PHP),全部都是RESTful的。
大概思路就是这样:
一切都配合AngularJS和RESTful,这样本地应用只存静态页面,然后通过叭叭叭发送请求数据返回就可以了……。
感受
使用Google自家的AngularJS,几乎大部分浏览器特性都可以使用,兼容性非常好,而且与桌面软件几乎无差,最重要的是了却了我多年学不会软件开发(尝试过delphi未果)的心愿……Web App太强大了!
资源 (需梯子)
Chrome Web App中文开发手册
Google Plus中文社群
官方英文论坛
问题
在开发过程中遇到了几个问题:
permissions不仅仅可以调用功能,如果使用外部资源也要加进去;
你可以放心大胆的使用类似-webkit,甚至V8的API;
-webkit-app-region: drag 可以控制应用拖动;
如果你执意要frame: 'none'的话,别忘记加上关闭按钮;
期待与大家交流

PHPidentifiesauser'ssessionusingsessioncookiesandsessionIDs.1)Whensession_start()iscalled,PHPgeneratesauniquesessionIDstoredinacookienamedPHPSESSIDontheuser'sbrowser.2)ThisIDallowsPHPtoretrievesessiondatafromtheserver.

The security of PHP sessions can be achieved through the following measures: 1. Use session_regenerate_id() to regenerate the session ID when the user logs in or is an important operation. 2. Encrypt the transmission session ID through the HTTPS protocol. 3. Use session_save_path() to specify the secure directory to store session data and set permissions correctly.

PHPsessionfilesarestoredinthedirectoryspecifiedbysession.save_path,typically/tmponUnix-likesystemsorC:\Windows\TemponWindows.Tocustomizethis:1)Usesession_save_path()tosetacustomdirectory,ensuringit'swritable;2)Verifythecustomdirectoryexistsandiswrita

ToretrievedatafromaPHPsession,startthesessionwithsession_start()andaccessvariablesinthe$_SESSIONarray.Forexample:1)Startthesession:session_start().2)Retrievedata:$username=$_SESSION['username'];echo"Welcome,".$username;.Sessionsareserver-si

The steps to build an efficient shopping cart system using sessions include: 1) Understand the definition and function of the session. The session is a server-side storage mechanism used to maintain user status across requests; 2) Implement basic session management, such as adding products to the shopping cart; 3) Expand to advanced usage, supporting product quantity management and deletion; 4) Optimize performance and security, by persisting session data and using secure session identifiers.

The article explains how to create, implement, and use interfaces in PHP, focusing on their benefits for code organization and maintainability.

The article discusses the differences between crypt() and password_hash() in PHP for password hashing, focusing on their implementation, security, and suitability for modern web applications.

Article discusses preventing Cross-Site Scripting (XSS) in PHP through input validation, output encoding, and using tools like OWASP ESAPI and HTML Purifier.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
