I am learning about the 7 layers of OSI. But I am currently stuck trying to understand these bottom two layers. Specifically - who performs the actions in these layers? They are called software layers but does the browser itself do all of these and how? Or the browser passes it on to a different program? How does it work?
So for example, I type in my browser google.com then the browser will establish a connection and send GET / …
我已经创建了我的 Docker compose 和 Dockerfile,但正如您所看到的,我正在从 Docker Hub 下载 PHP,并且还在下载和安装 PHP 扩展。但是,如果 20 年后这些镜像/包将不再托管在 Docker hub 上呢?如果我想仍然能够运行我的容器怎么办?
我能以某种方式及时冻结我的容器吗?我可以将它们全部捆绑在一起,这样如果我从现在起 100 年后回到它并运行我的图像,它仍然可以工作吗?我不想让它出去从互联网上下载任何东西。我想现在下载所有内容,并在将来运行它。
Docker 撰写文件:
version: '3'
services:
php:
build:
context: ./php
dockerfile: Dockerfile
image: digitalocean.com/php
container_name: php
Run Code Online (Sandbox Code Playgroud)
还有我的 PHP Dockerfile:
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
Run Code Online (Sandbox Code Playgroud) 我刚刚在 Vue.js 中学习状态管理,我不太明白为什么它需要如此复杂和混淆所有这些不同的方法(突变、getter、setter)。直接改数据不是更简单吗?看起来是不是更干净了?
像这样使用纯代码有什么问题?我在这里缺少什么?除了我必须在每个组件中定义store: window.store。这样做对我来说是否安全,或者我是否非常有必要使用 Vuex?
// global app data
window.store = {
appName: 'Hello World!'
}
export default {
template: `
<div @click="changeAppName">Hellow {{ store.AppName }}</div>
`,
data()
{
return {
store: window.store
}
}
methods: {
changeAppName() {
store.appName = 'Reactive app name!'
}
}
};
Run Code Online (Sandbox Code Playgroud) 我有一个折线 Chart.js 图表,其中标签是星期几。我想根据日期(周一至周日)更改点背景。我可以根据数据值更改背景颜色,但这不是我需要的。相反,我想给每一天(标签)一个不同的色点。
例如,这就是我可以根据数据值(不是我需要的)更改点的方法
chartData: {
labels: ['Monday', 'Tuesday', 'Wednesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
datasets: [{
data: [57, 569, 12, 78, 569, 0, 5],
fill: true,
pointRadius: 4,
pointBackgroundColor: function(context) {
var index = context.dataIndex
var value = context.dataset.data[index]
return value > 100 ? 'green' : 'red'
}
}]
},
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将其应用于标签时,出现错误:
类型错误:无法读取 pointBackgroundColor 处未定义的属性“0”
chartData: {
labels: ['Monday', 'Tuesday', 'Wednesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
datasets: [{
data: [57, 569, 12, 78, 569, 0, 5],
fill: true,
pointRadius: 4, …Run Code Online (Sandbox Code Playgroud) 我试图创建一个新的数组,其中键将是第一个数组的标题,值将是所有其他数组,但我得到一个空数组作为结果.
这是我的初始数组
$reader = \Asan\PHPExcel\Excel::load('test.xls', function(\Asan\PHPExcel\Reader\Xls $reader){});
foreach ($reader as $row)
{
print_r($row);
}
Array
(
[0] => Phone
[1] => Sum
[2] => Name
[3] => Something else
)
Array
(
[0] => +1 555123456
[1] => 50.00
[2] => Johnny Doe
[3] => 100.50
)
Array
(
[0] => 911
[1] => 20.12
[2] => Eli the Computer Guy
[3] => 99.99
)
Run Code Online (Sandbox Code Playgroud)
我试着像这样创建新的数组
$row = 1; // header row
foreach ($reader as $row)
{
if ($row == …Run Code Online (Sandbox Code Playgroud) 我正在使用XAMPP,并在C:\ xampp \ htdocs \ larascopy中使用composer create-project --prefer-dist laravel / laravel larascopy安装了一个新的Laravel 5.8
我可以通过以下网址访问它: http:// localhost / larascopy / public /
然后使用《指南》中的以下命令安装Telescope:
composer require laravel/telescope
php artisan telescope:install
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
然后我可以像这样打开望远镜 http:// localhost / larascopy / public / telescope
但是所有链接都是错误的!他们指向: http:// localhost / telescope / ...
所以我在控制台中收到所有这些错误。
POST http://localhost/telescope/telescope-api/commands?tag=&before=&take=50&family_hash= 404 (Not Found)
POST http://localhost/telescope/telescope-api/commands?tag=&before=&take=50&family_hash= 404 (Not Found)
POST http://localhost/telescope/telescope-api/schedule?tag=&before=&take=50&family_hash= 404 (Not Found)
app.js?id=8776cf12ba6d7c72f145:1 Uncaught (in promise) Error: Request failed with status code 404
Run Code Online (Sandbox Code Playgroud)
有没有办法告诉望远镜正确的路径?
我有一个原始查询,当我在phpMyAdmin中运行此查询时,它返回3个结果,但是当我尝试使用Laravel查询生成器时,我得到一个空数组。
我的查询
SELECT id, reply_text, sending_time
FROM sms_sender_inbox_replies
WHERE phone_number
IN ('+1234567819', '+19873216154', '+15984989898')
AND id IN (
SELECT MAX( id )
FROM sms_sender_inbox_replies
GROUP BY phone_number
)
Run Code Online (Sandbox Code Playgroud)
结果:
+----+-----------------+---------------------+
| id | reply_text | sending_time |
+----+-----------------+---------------------+
| 87 | This is a test | 2019-07-30 08:25:26 |
| 54 | And another one | 2019-07-29 06:35:11 |
| 12 | Last test | 2019-06-16 09:44:26 |
+----+-----------------+---------------------+
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用Laravel进行此查询时,我得到了一个空数组[]
dump($phone_numbers);
// 0 => "+1234567819"
// 1 => "+19873216154"
// …Run Code Online (Sandbox Code Playgroud) 我刚刚开始学习 Vue.js,但遇到了一个问题,我不知道如何访问和更改组件内的文本字段值。
假设我想访问或更改组件内第一个输入字段的值
我的组件
Vue.component('simple-input',
{
template: `
<input type="text" value="Some value...">
`,
});
Run Code Online (Sandbox Code Playgroud)
超文本标记语言
<div id="root">
<simple-input></simple-input>
<simple-input></simple-input>
<simple-input></simple-input>
<div @click="alertSimpleInput1">Show first input value</div>
<div @click="changeInput1('new value')">Change input value</div>
<div @click="alertSimpleInput2">Show second input value</div>
</div>
Run Code Online (Sandbox Code Playgroud)
main.js
new Vue({
el: '#root',
});
Run Code Online (Sandbox Code Playgroud) 我知道新的全屏 API,但我找不到任何方法来检查浏览器此时是否处于全屏模式。我对 Chrome 特别感兴趣。有可能吗?
我正在寻找这样的东西
window.addEventListener('load', function() {
if (FULLSCREEN) {
console.log('We are in full screen mode!')
} else {
console.log('Normal mode')
}
})
Run Code Online (Sandbox Code Playgroud) javascript ×4
php ×3
laravel ×2
vue.js ×2
arrays ×1
browser ×1
chart.js ×1
charts ×1
containers ×1
docker ×1
dockerfile ×1
eloquent ×1
fullscreen ×1
http ×1
linechart ×1
mysql ×1
networking ×1
osi ×1
router ×1
sql ×1
tcp ×1
vuex ×1