thinkphp仿京东


thinkphp3.2.3所写的仿京东商城,比较简化,带有数据库,可以学习很合适
资源截图
代码片段和文件信息
#!/usr/bin/env python


import cgi
try:
import json
except ImportError:
import simplejson as json
import elFinder

# configure connector options
opts = {
#‘root‘: ‘/home/troex/Sites/git/elfinder/files‘
‘root‘: ‘../git/elfinder/files/‘
‘URL‘: ‘http://localhost:8001/~troex/git/elfinder/files‘
## other options
‘debug‘: True
‘fileURL‘: True  # download files using connector no direct urls to files
# ‘dirSize‘: True
# ‘dotFiles‘: True
# ‘perms‘: {
#  ‘backup‘: {
#  ‘read‘: True
#  ‘write‘: False
#  ‘rm‘: False
#  }
#  ‘^/pics‘: {
#  ‘read‘: True
#  ‘write‘: False
#  ‘rm‘: False
#  }
# }
# ‘uploadDeny‘: [‘image‘ ‘application‘]
# ‘uploadAllow‘: [‘image/png‘ ‘image/jpeg‘]
# ‘uploadOrder‘: [‘deny‘ ‘allow‘]
# ‘disabled‘: [‘rename‘ ‘quicklook‘ ‘upload‘]
}

# init connector and pass options
elf = elFinder.connector(opts)

# fetch only needed GET/POST parameters
httpRequest = {}
form = cgi.FieldStorage()
for field in elf.httpAllowedParameters:
if field in form:
httpRequest[field] = form.getvalue(field)
if field == ‘upload[]‘:
upFiles = {}
cgiUploadFiles = form[‘upload[]‘]
for up in cgiUploadFiles:
if up.filename:
upFiles[up.filename] = up.file # pack dict(filename: filedescriptor)
httpRequest[‘upload[]‘] = upFiles

# run connector with parameters
status header response = elf.run(httpRequest)

# get connector output and print it out

# code below is tested with apache only (maybe other server need other method?)
if status == 200:
print ‘Status: 200‘
elif status == 403:
print ‘Status: 403‘
elif status == 404:
print ‘Status: 404‘

if len(header) >= 1:
for h v in header.iteritems():
print h + ‘: ‘ + v
print

if not response is None and status == 200:
# send file
if ‘file‘ in response and isinstance(response[‘file‘] file):
print response[‘file‘].read()
response[‘file‘].close()
# output json
else:
print json.dumps(response indent = True)




## logging
#import sys
#log = open(‘/home/troex/Sites/git/elfinder/files/out.log‘ ‘w‘)
#print >>log ‘FORM: ‘ form
#log.close()

## another aproach
## get connector output and print it out
#if elf.httpStatusCode == 200:
# print ‘HTTP/1.1 200 OK‘
#elif elf.httpStatusCode == 403:
# print ‘HTTP/1.x 403 Access Denied‘
#elif elf.httpStatusCode == 404:
# print ‘HTTP/1.x 404 Not Found‘
#
#if len(elf.httpHeader) >= 1:
# for header value in elf.httpHeader.iteritems():
# print header + ‘: ‘ + value
# print
#
#if not elf.httpResponse is None:
# if isinstance(elf.httpResponse[‘file‘] file):
# print elf.httpResponse[‘file‘].read()
# elf.httpResponse[‘file‘].close()
# else:
# print json.dumps(elf.httpResponse indent = True)
#

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-16 14:09  thinkPHP仿京东商城
     目录           0  2016-06-24 17:59  thinkPHP仿京东商城数据库文件和安装说明
     文件      223410  2014-10-27 15:40  thinkPHP仿京东商城数据库文件和安装说明jd.sql
     文件         211  2016-06-24 17:59  thinkPHP仿京东商城数据库文件和安装说明
eadme.txt
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码
     文件         203  2014-10-10 16:31  thinkPHP仿京东商城源代码.htaccess
     文件        1067  2016-06-24 17:12  thinkPHP仿京东商城源代码Admin.php
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码Application
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdmin
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommon
     目录           0  2018-04-18 08:36  thinkPHP仿京东商城源代码ApplicationAdminCommonCss
     目录           0  2018-04-18 08:36  thinkPHP仿京东商城源代码ApplicationAdminCommonImages
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommonJs
     文件        2286  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsadmin_action.js
     文件         897  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsadmin_action_bbk.js
     文件        4958  2014-10-12 23:38  thinkPHP仿京东商城源代码ApplicationAdminCommonJsadmin_add.js
     文件        3494  2014-10-12 23:38  thinkPHP仿京东商城源代码ApplicationAdminCommonJsadmin_aedit.js
     文件        3189  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsadmin_edit.js
     文件        1149  2014-10-12 23:36  thinkPHP仿京东商城源代码ApplicationAdminCommonJscheck_login.js
     文件        1636  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsindex_action.js
     文件        8827  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsmd5.js
     文件        1338  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJs
ews.js
     文件         143  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsstyle_change.js
     文件         266  2014-10-10 16:31  thinkPHP仿京东商城源代码ApplicationAdminCommonJsuser.js
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplate
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrap
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrapcss
     文件       36827  2014-10-10 16:30  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrapcssootstrap.css
     文件       31268  2014-10-10 16:30  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrapcssootstrap.min.css
     目录           0  2016-06-24 18:00  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrapjs
     文件       19176  2014-10-10 16:30  thinkPHP仿京东商城源代码ApplicationAdminCommonTemplateootstrapjsootstrap.js
............此处省略4327个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)