⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 11 - setting and retrieving cookies.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
class ApplicationController < ActionController::Base  before_filter :count_visits    private    def count_visits    value = (cookies[:visits] || '0').to_i    cookies[:visits] = (value + 1).to_s    @visits = cookies[:visits]  endend#---<!-- index.rhtml -->You've visited this website's pages <%= @visits %> time(s).#---cookies[:user_id] = { :value => '123', :expires => Time.now + 1.hour} #---cookies.delete :user_id#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -