当我登录用户并使用标题重定向时,我的会话变量为空.
/* Login page */
session_register("myusername");
session_register("mypassword");
$_SESSION['myusername'] = $_POST['myusername'];
header("location:page.php");
/* page.php */
<?php echo $_SESSION[myusername]; ?>
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的选择列表创建一个选项:
getMarkOptions: function () {
var options = this.props.renderProps;
return options.map(function (mark, i) {
return <option
key={i}
value={mark}>
{mark}
</option>
});
},
render: function () {
console.log('mark editor ' + this.props);
var selectedMark = this.props.value,
row = this.props.data,
highlightCurrentDay = this.props.highlight ? 'edit-select__currentDay':'';
return (
<select
value={selectedMark}
ref="selectMark"
className={"edit-select form-control " + highlightCurrentDay}
onChange={this.onChange}
>
{this.getMarkOptions()}
</select>
);
}
Run Code Online (Sandbox Code Playgroud)
数据:
var marks = [
{"id": 1, "caption": "/", "code": "/", "meaning": "Present (AM)", "isStandardCode": true},
{"id": 2, "caption": "\\", "code": …Run Code Online (Sandbox Code Playgroud) 我正在尝试将此组件与使用es5的异步选项一起使用。我的componentDidmount中有一个服务调用,该调用使用回调设置school数组:
componentDidMount: function(){
SchoolsDataService.getSchools(
this.setSchoolsState
);
Run Code Online (Sandbox Code Playgroud)
将学校列表设置为状态数组
setSchoolsState: function(data){
this.setState({schools: data.schools})
},
Run Code Online (Sandbox Code Playgroud)
服务:
getSchools: function (callback) {
var url = 'xxxx';
request
.get(url)
.set('Accept', 'application/json')
.end(function (err, res) {
if (res.ok) {
var data = res.body;
if (data) {
callback(data);
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
如何使用文档中的示例进行设置?我在哪里将这样的异步版本的服务调用放在哪里并生成选项列表?
var getOptions = function(input, callback) {
setTimeout(function() {
callback(null, {
options: [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
],
// CAREFUL! Only set this to true when …Run Code Online (Sandbox Code Playgroud) 任何想法这个错误是什么意思?
当我尝试运行时,npm run playground-android出现错误。
失败:构建失败,发生异常。出了什么问题:任务':app:processDebugResources'的执行失败。java.io.IOException:无法删除路径'C:\ sites \ ReactMatt \ lower-drinking \ android \ app \ build \ Generated \ source \ r \ debug \ org \ webkit'。
有任何想法吗?
我试图在下面的减速器中更新状态。
结果对象具有两个数组:
results: {
correctAnswers: [7]
incorrectAnswers: (9) [0, 1, 2, 3, 4, 5, 6, 8, 9]
}
Run Code Online (Sandbox Code Playgroud)
如何添加totalScore到结果对象?下面的代码添加totalScore,但删除correctAnswers和incorrectAnswers。
case "COMPLETE_QUIZ": {
const { totalScore, id } = action.data;
console.log(action.data, state);
return {
videos: state.videos.map(video =>
video.id === id
? {
...video,
results: {
totalScore \\ add here
},
completed: true
}
: video
),
search: { term: "", videos: [] }
};
}
Run Code Online (Sandbox Code Playgroud) 我试图打开一个模态并用状态数据填充它.
根据我的理解,除了使用bind(this)之外,是否可以构造此方法?回调可以作为一种选择吗?
showExclusionDialog: function(){
if(!this.state.exclusionReasons) {
if(!this.state.exclusionReasons) {
ExclusionLookupService.getReasons(function(reasons){
this.setState({exclusionReasons: reasons});
}.bind(this));
}
}
if(!this.state.exclusionTypes) {
ExclusionLookupService.getTypes(function(types){
this.setState({exclusionTypes: types});
}.bind(this));
}
if(!this.state.exclusionSessions) {
ExclusionLookupService.getSessions(function(sessions){
this.setState({exclusionSessions: sessions});
}.bind(this));
}
this.setState({exclusionDialogShow: true});
},
Run Code Online (Sandbox Code Playgroud) I get the above error when I try and send messages to devices:
let functions = require("firebase-functions");
const admin = require("firebase-admin");
var serviceAccount = require("./configs.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://pushmessage-bd1eb.firebaseio.com"
});
const db = admin.firestore();
exports.getUsers = functions.https.onRequest(async (req, res) => {
db.collection("users")
.get()
.then(snapshot => {
const messaging = admin.messaging();
let registrationTokens = [];
snapshot.forEach(doc => {
let id = doc.id;
registrationTokens.push(id);
});
console.log(registrationTokens);
// process the tokens
const message = {
data: { title: "Testing", body: "Test" }, …Run Code Online (Sandbox Code Playgroud) reactjs ×4
javascript ×1
node.js ×1
php ×1
react-native ×1
react-select ×1
redux ×1
session ×1