sae新浪云开发者认证

玩了一下新浪云开发者认证,需要凑够1000点击量,因此做了个短网址还原和生成的程序,恳求各位帮忙点击一下此网址: http://dwzhy.sinaapp.com/ ,以便小弟能够成功申请。不胜感激



  以下是新浪云平台开发会出现的问题及解决方案
  1、不允许直接直接写入文件
  导致问题:
  1.1)因“编译”型模板引擎无法保存“编译”后的PHP脚本,系统无法使用
  SEA官方提供TmpFS方案来解决,并不完美,因为TmpFS的周期等同于PHP请求,每次请求都要生成一次TmpFS,这TmpFS要来何用。
  解决方案:使用Wrapper
  SAE提供了基于Memcache的Wrapper “saemc://”
  例如,include一个Memcache中的模板,这个模板文件在Memcache使用的Key为”template.php” Value为模板内容.具体代码内容如下: 
  $filepath = ‘/template.php’ ; //可以直接用文件的路径做Memcache的Key
  include( ‘saemc://’.$filename ) ; //只需在路径前加上”saemc://”
  file_put_contents(‘saemc://’.$filename); // 写入文件
  之前解决方案:使用memcache(Mysql、Storage也可以,用Memcache性能最好)来存贮“编译”后的文件
  1
  2
  3
  4
  5
  6
  7
  8
  $tploriginal='';
  $mmc=memcache_init();
  if($mmc==false){
  echo"mc init failed\n";
  }else{
  $tploriginal=memcache_get($mmc,"key.of.my.tpl");
  eval('?>'.$tplsrc); // 要害处
  }
  1.2)文件方式缓存不能使用
  解决方案:我们常用文件缓存来保存配置信息和做一些缓存,这个就需要移植到使用memcache了
  1.3)文件上传处理要移植
  解决方案:只能使用新浪云提供的Storage服务。
  1.4)不能直接生成图片缩略图
  解决方案:把缩略图写入到Storage中,用api获取URL。
  2、执行时间限制
  新浪云PHP执行时间限制30秒,但我们有些地方需要比较长的时间。
  2.1)大批量数据操作
  大规模数据库导入
  大规模数据库导出
  数据库大批量操作
  解决方案:使用DeferredJob
  2.2)数据抓取
  使用SaeFetchurl
  http://apidoc.sinaapp.com/sae/SaeFetchurl.html

  3)没有启用php_socket
  3.1)不能用smtp发送邮件
  可代替方案:SeaMail
  3.2)不能用soket读取网络上的文件
  可代替方案:SaeFetchurl
  4. Session&Cookie
  4.1 session.cookie_httponly = true并且SEA不允许ini_set修改
  PHP默认的session.cookie_httponly = false。
  在sea中,如果你想要用js等非http请求读取cookie,那时不行滴
  解决方案:在session_start()之前使用 session_set_cookie_params($lifeTime, ‘/’, ”, false, false); // $lifeTime >= 0
  5. 数据库
  5.1 mysql_insert_id()
  PHP文档中如是说:如果 AUTO_INCREMENT 的列的类型是 BIGINT,则 mysql_insert_id() 返回的值将不正确。可以在 SQL 查询中用 MySQL 内部的 SQL 函数 LAST_INSERT_ID() 来替代。
  在很多情况下(也许是64位的MySQL),BIGINT的主键mysql_insert_id()是没问题的,但是在sea中就是如php文档这么规范。用 SELECT LAST_INSERT_ID() 查询获取结果来取代mysql_insert_id()吧
  ———————————————————-
  Runtime 限制
  限制项 限制说明
  PHP执行时间 30秒
  PHP内存限制 64MB
  post大小限制 10MB
  upload大小限制 10MB
  单App内存大小限制 2GB
  单App并发连接限制 400
  未来会推出限制更宽松的高级版。
  禁用的函数:
  php_real_logo_guid
  php_egg_logo_guid
  php_ini_scanned_files
  php_ini_loaded_file
  readlink
  linkinfo
  symlink
  link
  exec
  system
  escapeshellcmd
  escapeshellarg
  passthru
  shell_exec
  proc_open
  proc_close
  proc_terminate
  proc_get_status
  proc_nice
  getmyuid
  getmygid
  getmyinode
  putenv
  getopt
  sys_getloadavg
  getrusage
  get_current_user
  magic_quotes_runtime
  set_magic_quotes_runtime
  import_request_variables
  debug_zval_dump
  ini_alter
  dl
  pclose
  popen
  stream_select
  stream_filter_prepend
  stream_filter_append
  stream_filter_remove
  stream_socket_client
  stream_socket_server
  stream_socket_accept
  stream_socket_get_name
  stream_socket_recvfrom
  stream_socket_sendto
  stream_socket_enable_crypto
  stream_socket_shutdown
  stream_socket_pair
  stream_copy_to_stream
  stream_get_contents
  stream_set_write_buffer
  set_file_buffer
  set_socket_blocking
  stream_set_blocking
  socket_set_blocking
  stream_get_meta_data
  stream_get_line
  stream_register_wrapper
  stream_wrapper_restore
  stream_get_transports
  stream_is_local
  get_headers
  stream_set_timeout
  socket_get_status
  mail
  openlog
  syslog
  closelog
  apc_add
  apc_cache_info
  apc_clear_cache
  apc_compile_file
  apc_define_constants
  apc_delete
  apc_load_constants
  apc_sma_info
  apc_store
  flock
  fsockopen
  pfsockopen
  posix_kill
  apache_child_terminate
  apache_get_modules
  apache_get_version
  apache_getenv
  apache_lookup_uri
  apache_reset_timeout
  apache_response_headers
  apache_setenv
  virtual
  mysql_pconnect
  memcache_add_server
  memcache_connect
  memcache_pconnect
  禁用的类:
  XMLWriter
  DOMDocument
  DOMNotation
  DOMXPath
  SQLiteDatabase
  SQLiteResult
  SQLiteUnbuffered
  SQLiteException
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值