Skip to main content

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

drupal entity type 和 bundle 概念理解

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

Entity

 

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

 JS获取 JSON 子项/数组的个数/长度

<script type="text/javascript">

var json = {'data': ['a', 'b', 'c']}

length = Object.keys(json.data).length

var json = {'name':'abc', 'age': 16}

length = Object.keys(json).length

</script>

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 

splice用法:

用 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 源码