这是我的代码,我得到"Uncaught TypeError:undefined不是函数"我做错了什么?
var myDate = new Date().setDate(17);
document.getElementById("result").innerHTML = myDate.getDate();
Run Code Online (Sandbox Code Playgroud) 我是SLIM3的新手,并按照教程在容器中获取我想从代码中的任何位置访问的一些函数.所以这是我的index.php文件,我在那里推荐一切:
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
// Require for loading the vendor libraries installed by composer
require 'vendor/autoload.php';
$config['displayErrorDetails'] = true;
$config['addContentLengthHeader'] = false;
$app = new \Slim\App(["settings" => $config]);
$container = $app->getContainer();
// Monolog initalisation. To use it write: $this->logger->addInfo("what you want to write here");
$container['logger'] = function($c) {
$logger = new \Monolog\Logger('eq_logger');
$file_handler = new \Monolog\Handler\StreamHandler("logs/app.log");
$logger->pushHandler($file_handler);
return $logger;
};
// Database connections
$container['dbteacher'] = function ($c) {
$pdo = new PDO($_SERVER['PGSQL_CONNECTION_STR']); …Run Code Online (Sandbox Code Playgroud) 我的代码结构是:
.gitignore
my-service << this is a file without an extention
charts
| my-service << this is a folder
| | file1
| | file2
Run Code Online (Sandbox Code Playgroud)
当我在我的gitignore中写道时,my-service它忽略了my-service文件和my-service文件夹.如何只忽略根目录中的文件,而不是子目录?
我在这里迷失了方向,我试图让一个goroutine添加到数组中,并从中读取另一个goroutine,我怀疑它与下面的内容有些相似,但我需要尝试使用wait() 。
但是,我遇到了错误prog.go:19:14: too many variables in range,第19行是for _, v := range c {我在网上找不到答案,我在做什么或不做什么?
package main
import (
"fmt"
//"time"
"sync"
)
func hello(wg *sync.WaitGroup, s []int, c chan int) {
for _, v := range s {
c <- v
}
fmt.Println("Finished adding to channel")
wg.Done()
}
func hello2(wg *sync.WaitGroup, c chan int) {
fmt.Println("Channel",c)
for _, v := range c {
fmt.Println("Received",v)
}
fmt.Println("Finished taking from channel")
wg.Done()
}
func main() {
s := …Run Code Online (Sandbox Code Playgroud)