Home
JetDrupal
  • Home
  • Drupal 开发
  • Web Dev
  • Speak in English
  • Contact
本作品采用知识共享署名 4.0 国际许可协议进行许可。
Powered by Drupal © 2022 Ng

“福利彩票” 用英语怎么说

法国人曾这么描述“福利彩票”:政府发行彩票是向公众推销机会和希望,公众认购彩票则是微笑纳税。据悉,去年中国福利彩票共销售约495亿多元人民币,筹集福彩公益金170多亿元。其中,公益金除部分上缴国家财政外,全部用于社会福利事业。

请看《中国日报》相关报道:The sale of China Welfare Lottery, the only national lottery approved by the Chinese government, hit a record high of 49.5 billion yuan (6.2 billion U.S. dollars) in 2006, up 20 percent from the previous year Half of the money has been turned over to the coffer of the central government. The remaining funds were used for social welfare purposes.

2019.05.13
1 min

drupal 商城安装

drupal 商城安装:

composer create-project drupalcommerce/project-base demo --stability dev

drupal
commerce
2019.05.07
1 min

drupal 管理员密码忘了怎么办?

怎么办?怎么办?怎么办? 我已经忘了3次了。。。。

不要担心,官网给出的方案,前提是可以登录后台服务器。

Note: leaving this password reset script on your server after resetting the password constitutes a highly critical security hole that enables anyone to reset your administrator password. Use this script carefully, and always delete the script after you're finished using it.

drupal
2019.05.02
2 mins

composer 安装打不开 packagist.phpcomposer

composer 打不开 packagist.phpcomposer,可以尝试换 laravel 的

composer config -g repo.packagist composer https://packagist.laravel-china.org

or

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

安装 repo 管理器 crm:

composer global require slince/composer-registry-manager

用法:

composer repo:ls composer repo:use aliyun

composer
2019.05.01
1 min

Drupal 8 里两种查询方式的分页实例

D8 里有两种数据查询:一种是利用 db_query 直接对数据库表操作,一种是采用 entityTypeManager 进行实体操作。 两种方式的分页处理略有不同,在实际应用中可以灵活使用。下面是两个实例展示:
drupal
2019.04.29
1 min

drupal entity type 和 bundle 概念理解

Entity 在 drupal 里是一个很重要的概念。个人理解:drupal 也是在面向对象的思想上对其提炼,即世上万物皆对象。其概念有点类似生物学上的界门纲目科属种层级关系。Entity type 就是大类,比如水果;Bundle 就是子类,比如西瓜;Field 就是水果属性,比如西瓜是圆的,绿皮带条纹,有籽无籽等。而 Entity 就是更具象指这个西瓜(实例)。

Entity

 

  • An entity type is a base class
  • A bundle is an extended class
  • A field is a class member, property, variable or field instance (depending on your naming preference)
  • An entity is an object or instance of a base or extended class
Entity type
Bundle
2019.04.28
2 mins

php array 转化 JSON 格式化输出

json_encode ( mixed $value [, int $options = 0 [, int $depth = 512 ]] ) : string

返回字符串,包含了 value 值 JSON 形式的表示。

例子: 1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); echo json_encode($arr); ?>

输出:

{"a":1,"b":2,"c":3,"d":4,"e":5}

Json
2019.04.26
1 min

微信小程序中 JS 获取 JSON 对象长度或增加删除对象

JSON 数组删除

var test = [{ "a": "1", "b": "2" }, { "a": "3", "b": "4" }, { "a": "5", "b": "6" }];

test.length //输出为 3

test.splice(1, 1);

test.length //输出为 2
Json
JS
2019.04.25
1 min

如何开启 drupal debug 模式

Set the debug variable to true. And clear cache.

parameters:
  twig.config:
    debug: true 
    auto_reload: true 
    cache: false
drupal
2019.03.12
1 min

用 composer 安装 drupal 及用 drush 升级

  1. 安装 composer

    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin

  2. composer 不建议用 root 用户,新建用户并授权

    useradd -d /home/ng -m ng passwd ng usermod -s /bin/bash ng chown -R ng /var/www/*

  3. 建库

    CREATE DATABASE example_database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'pwd';

  4. 下载 drupal 源码

    composer create-project drupal-composer/drupal-project:8.x-dev jetdrupal.com --no-interaction --no-dev

  5. 安装, 新版本需要在上级目录新建这两个文件夹

    mkdir -p config/sync

  6. 安装 drush

    composer require drush/drush

    (https://github.com/drush-ops/drush-launcher)

  7. 升级

    sql-dump --result-file=../db.sql

    drush pm:security

    composer update drupal/core webflo/drupal-core-require-dev --with-dependencies

    composer update drupal/modulename --with-dependencies

    drush updatedb

    drush cr

composer
drupal
drush
2019.03.11
1 min

Useful links

  • How to Log Messages in Drupal 8
  • Building a real site in Drupal 8
  • Building modules with Drupal 8
  • Let’s debug in Drupal 8 !
  • update admin password
  • Nginx fail2ban
2019.03.10
1 min

Nginx 301重定向 -- 带或不带 WWW 指向同一站点

vi /etc/nginx/sites-enabled/example

server { listen 80; server_name example.org; return 301 http://www.example.org$request_uri; } server { listen 80; server_name www.example.org; ... }

Nginx
php
drupal
2019.03.08
1 min

Pagination

  • First page First
  • Previous page
  • Page 1
  • Current page 2