echo json_encode([‘a‘ => 1] + [‘b‘ => 2, ‘a‘ => 3, ‘b‘]);
//输出:
$param = 1;
$funcA = function ($val) use (&$param) {
$param++;
return $param + $val;
};
$funcB = function () use ($param) {
$param++;
return $param;
};
var_dump($funcA(2)); //结果:
var_dump($funcB()); //结果:
var_dump($param); //结果:
Notice: Undefined variable: test
Fatal error: Uncaught Error: Class ‘Foo\Test‘ not found
Fatal error: Uncaught Error: Call to a member function abc() on null
Fatal error: Uncaught Error: Call to undefined method Test::abc()
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::abc()
Parse error: syntax error, unexpected ‘;‘, expecting ‘]‘
__callStatic()
__toString()
__invoke()
__sleep()
class Test1 {
protected static $instance;
public static function getInstance() {
if (! self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}
class Test2 {
public function factory($config) {
return new self($config);
}
}
class Reader implements SplObserver {
public function update(SplSubject $subject) {
echo $subject->title;
}
}
class News implements SplSubject {
private $observers = [];
public function attach(SplObserver $observer) {
$this->observers[] = $observer;
}
public function detach(SplObserver $observer) {}
public function notify() {
foreach ($this->observers as $obj) {
$obj->update($this);
}
}
}
composer global require
与 composer require
区别"^1.2.3"
"~1.2.3"
POST /index.php?ccc=123 HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: application/json
Content-Length: 28
{"aaa":"test","bbb":[1,2,3]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 40
{"aaa":"test","bbb":[1,2,3],"ccc":"123"}
如,获取所有用户列表: GET /users
请写出相应的增删改:
有 a.js
和 b.js
请用 CMD 或 AMD 模块化规范写出 b.js
如何引用 a.js
.
你所使用的构建工具是(glup, grunt, webpack) ?
请写出 es6 的新语法特性(至少3个)
a.com/index.html
访问 b.com/api.php
的数据, 遇到跨域问题, 请写出在 HTML5中的跨域解决方案
如何看待前后端分离, 如果让你设计一前后端分离的后台管理系统, 你会运用哪些前后端的应用库和设计结构.
原文:https://www.cnblogs.com/yudubujue/p/15151851.html